[Lazarus] I say a little prayer (for the Lazarus editor)

Martin Frb lazarus at mfriebe.de
Sun Feb 21 12:30:04 CET 2021


On 21/02/2021 10:02, duilio foschi wrote:
> Hi Martin,
>
> I am too lazy to learn how to use editor scripts.
>
> Probably it will be more productive to spend some time to correct the 
> editor code.
>
> After all, the Jedi editor - written in Delphi and available in source 
> code - behaves like old Delphi editor in column mode.
>
> How can I try to fix the problem?
>
> Where is the Lazarus repository with the original code of the Lazarus 
> editor?
>

Official: https://svn.freepascal.org/svn/lazarus/
For bugs and patches: 
https://bugs.freepascal.org/set_project.php?project_id=1

I am running a mirror at https://github.com/User4martin/lazarus/
For most SynEdit and Debugger issues, I can accept pull requests (those 
go to me only, no one else in the team, therefore limited to work I will 
deal with)

SynEdit is in Components/SynEdit

If you are looking for the Search/Replace dialog, afaik its in the 
folder ide/ . Best to start looking from the file ide/SourceEditor.pp . 
But probably you want SynEdit.

SynEdit.pp
You probably want to look at function TCustomSynEdit.PasteFromClipboardEx

You should know about the caret pos 
https://wiki.lazarus.freepascal.org/SynEdit#Logical.2FPhysical_caret_position

You can get/set the caret pas on FCaret.
Also you will look for   PMode: TSynSelectionMode;

This actually sets the text: FInternalBlockSelection.SetSelTextPrimitive

So then you only need restore the CaretX

----
Now this is important, you will see it works on CaretBytePos (logical)
But you will need CharPos.

Imagine you copy columns from 2 or more lines.
Then (I guess) you want to set the caret to the start of the column in 
the *last* line to which was inserted..

If there is a tab at the first line you insert, then you may be at 
PhysX=4 and LogX=2 (behind the tab)
If there is no tab in the last line, and you set LogX =2 , well that is 
not what you want.


---------------------

Remind me, does the Caret go to the start of the insert, or does it 
automatically move one line down too?

And one more thing, if you plan to submit a patch, please add an option 
to SynEdit.Options2
Many people are used to the current behaviour, I do not plan to upset them.

The option will then be controlled from the IDE. So the patch will 
either wait till I get to do that.
Or if you volunteer ide/EditorOptions.pas  (search Options2 or ) 
ide/frames/editor_misc_options


More information about the lazarus mailing list