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

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
If the coder in charge of the editor reads this, I have a prayer for him:

1.

The text showed in 


is column-selected using shift+alt+arrow followed by ctrl-C

2. using the arrows key, I move the cursor to the position shown in


3. I press ctrl-V. The text ':string' is correctly copied into the 
expected position but... look at the cursor


The cursor is now at the position after the 'g' in the same row where the
text was copied. 

So in the Lazarus editor there is no difference in copying a text row-selected 
and a text column-selected.

In Delphi there is a big difference when you copy a text (at least until v. 7,
when I stopped using it).

Say you copy a text of lenght L from the clipboard into point (x,y). 
If the text is row-selected, Delphi sets the cursor at point (x+L,y), 
like the Lazarus editor does.

But if the text is column-selected, Delphi sets the cursor at point (x,y+1),
in the row below.

This enables you to quickly copy several rows of text, as shown here


This ability is a big plus for a coder...well... at least I remember I was using 
it often :)

.


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list

I'm not the coder, nor have any answer or thought on the matter, but I would like to point out that if you select text (any text) and then use a multi-cursor (pressing Alt+Shift+Down Arrow several times) and then Ctrl-V to paste, you get such a multi-row paste very easily.

Whether the mentioned IDE thing gets fixed or not, I find this the easier way.

Cheers!
Ryan


On 2021/02/20 12:06, duilio foschi via lazarus wrote:
If the coder in charge of the editor reads this, I have a prayer for him:

1.

The text showed in 


is column-selected using shift+alt+arrow followed by ctrl-C

2. using the arrows key, I move the cursor to the position shown in


3. I press ctrl-V. The text ':string' is correctly copied into the 
expected position but... look at the cursor


The cursor is now at the position after the 'g' in the same row where the
text was copied. 

So in the Lazarus editor there is no difference in copying a text row-selected 
and a text column-selected.

In Delphi there is a big difference when you copy a text (at least until v. 7,
when I stopped using it).

Say you copy a text of lenght L from the clipboard into point (x,y). 
If the text is row-selected, Delphi sets the cursor at point (x+L,y), 
like the Lazarus editor does.

But if the text is column-selected, Delphi sets the cursor at point (x,y+1),
in the row below.

This enables you to quickly copy several rows of text, as shown here


This ability is a big plus for a coder...well... at least I remember I was using 
it often :)

.



--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
Hi Ryan,

not the same result IMHO.

1.
I column-select the text shown in


Now the clipboard contains the text that extends from point (26,66) to point (26,72)

2.
I move the cursor to point (27,66). See


3. 
now I would like to press ctr-v 6 times and get the text inserted in the
following 6 rows...but I cant.

In fact, after the first insert, the cursor stays on row 27.

See


Instead, it should move to position (28,66)

4.

pic


shows the result I wanted from the start. I can get it only by several
uneeded clicks on the arrows keys...

5.

my point is: in Lazarus edit the act of inserting a text which is column-selected has the same 
result that the act of inserting a text which is row-selected. It would be nice to
differentiate the results (as it was in Delhi editor) so to satisfy different 
needs of the coder.

Thank you

Duilio

On Sat, Feb 20, 2021 at 11:58 AM R.Smith via lazarus <[hidden email]> wrote:

I'm not the coder, nor have any answer or thought on the matter, but I would like to point out that if you select text (any text) and then use a multi-cursor (pressing Alt+Shift+Down Arrow several times) and then Ctrl-V to paste, you get such a multi-row paste very easily.

Whether the mentioned IDE thing gets fixed or not, I find this the easier way.

Cheers!
Ryan


On 2021/02/20 12:06, duilio foschi via lazarus wrote:
If the coder in charge of the editor reads this, I have a prayer for him:

1.

The text showed in 


is column-selected using shift+alt+arrow followed by ctrl-C

2. using the arrows key, I move the cursor to the position shown in


3. I press ctrl-V. The text ':string' is correctly copied into the 
expected position but... look at the cursor


The cursor is now at the position after the 'g' in the same row where the
text was copied. 

So in the Lazarus editor there is no difference in copying a text row-selected 
and a text column-selected.

In Delphi there is a big difference when you copy a text (at least until v. 7,
when I stopped using it).

Say you copy a text of lenght L from the clipboard into point (x,y). 
If the text is row-selected, Delphi sets the cursor at point (x+L,y), 
like the Lazarus editor does.

But if the text is column-selected, Delphi sets the cursor at point (x,y+1),
in the row below.

This enables you to quickly copy several rows of text, as shown here


This ability is a big plus for a coder...well... at least I remember I was using 
it often :)

.


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 20/02/2021 11:06, duilio foschi via lazarus wrote:
>
> So in the Lazarus editor there is no difference in copying a text
> row-selected
> and a text column-selected.
Well there is no diff with regards to caret placement.

If you do column select over more than one line, and paste it, it will
insert each "cell" as column mode dictates. But then also place the
caret at the very end of the last cell.

>
> But if the text is column-selected, Delphi sets the cursor at point
> (x,y+1),
> in the row below.
I thought I had seen that once (I used to once have D5) but I could
neither remember where, nor how it was triggered....

Please report this as a feature request.

---------------------
If multi caret does not solve this, you can always use macros

Record macro / IIRC shift ctrl R
Set Bookmark 1
Paste
Go to Bookmark1
Go Down one line
END Record macro / IIRC shift ctrl R

Now Play the macro with IIRC shift ctrl P
as often as you need.
Skip line if needed as you like.


Using Pascal script macro, you can skip the bookmark.

Or recording the macro for a specific text to pase, where you know the
length you can use cursor-left as to go back the correct amount.


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
On 20/02/2021 15:03, Martin Frb via lazarus wrote:
>
>>
>> But if the text is column-selected, Delphi sets the cursor at point
>> (x,y+1),
>> in the row below.
> I thought I had seen that once (I used to once have D5) but I could
> neither remember where, nor how it was triggered....

Here is the Pascal script you need:

var x: Integer;
begin
x := Caller.CaretX;
ecPaste;
Caller.CaretX := x;
end.


Open the editor MAcro window : ctrl-shift L

- Record a new macro. You need to record something, e.g. move caret up,
while recording. End recording.
- Select the recorded macro in the list => EDIT
- Copy above script into the macro, replacing its content.
- Save (ctrl S)

Then rename the macro.
Assign a key to it.

Below the list of macros (in the macro window) is a "move to:" Project IDE

*** Move it to "IDE" ***

You can get to it again using the tabs above the list.

"Recorded" macros,  are deleted when you close the IDE
"Project" macros are kept but only avail for the one project.

"IDE" are global and kept.

---
Now you have a key to paste (column or normal selection) into the editor
and keep the X.

If you want you can add an
   ecDown
before the "end."

Then it will also go one line down.

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 20/02/2021 15:03, Martin Frb via lazarus wrote:


But if the text is column-selected, Delphi sets the cursor at point (x,y+1),
in the row below.
I thought I had seen that once (I used to once have D5) but I could neither remember where, nor how it was triggered....

Please report this as a feature request.

In Lazarus trunk you do not even need the clipboard.

https://imgur.com/a/uPyo4Eb  (ignore the context popup, I pressed the wrong button)

Lazarus can
- duplicate current line(s)
- move up/down current line(s)

AND
it can do the same for the selection.

Select your text. Duplicate it. Move it up/downs/left/right/
Duplicate again, Move again
.....

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On 20/02/2021 13:11, duilio foschi via lazarus wrote:
>
> pic
>
> https://i.ibb.co/jDBfSpZ/4.jpg <https://i.ibb.co/jDBfSpZ/4.jpg>
>
> shows the result I wanted from the start. I can get it only by several
> uneeded clicks on the arrows keys...
>
https://imgur.com/a/w5uzUhh

copy

Then instead of pasting once for each line, press Shift Alt down to set
cursors on each line
Do one single paste.

If I count correctly, one keystroke more (assuming that Delphi includes
cursor down, in the paste).
If in Delphi you do paste,down,paste,down,...  Then in Lazarus its less
keystrokes

However, multi caret works only when there are no lines to skip (well
you can set carets individually, but thats more work)


> 5.
>
> my point is: in Lazarus edit the act of inserting a text which is
> column-selected has the same
> result that the act of inserting a text which is row-selected. It
> would be nice to
> differentiate the results (as it was in Delhi editor) so to satisfy
> different
> needs of the coder.
>
See my other reply:
- Yes it should be added. (as build in)
- You can (in 2.0.10) add a macro that does it....

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
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? 

Thank you

Duilio 

On Sat, Feb 20, 2021 at 5:31 PM Martin Frb <[hidden email]> wrote:
On 20/02/2021 13:11, duilio foschi via lazarus wrote:
>
> pic
>
> https://i.ibb.co/jDBfSpZ/4.jpg <https://i.ibb.co/jDBfSpZ/4.jpg>
>
> shows the result I wanted from the start. I can get it only by several
> uneeded clicks on the arrows keys...
>
https://imgur.com/a/w5uzUhh

copy

Then instead of pasting once for each line, press Shift Alt down to set
cursors on each line
Do one single paste.

If I count correctly, one keystroke more (assuming that Delphi includes
cursor down, in the paste).
If in Delphi you do paste,down,paste,down,...  Then in Lazarus its less
keystrokes

However, multi caret works only when there are no lines to skip (well
you can set carets individually, but thats more work)


> 5.
>
> my point is: in Lazarus edit the act of inserting a text which is
> column-selected has the same
> result that the act of inserting a text which is row-selected. It
> would be nice to
> differentiate the results (as it was in Delhi editor) so to satisfy
> different
> needs of the coder.
>
See my other reply:
- Yes it should be added. (as build in)
- You can (in 2.0.10) add a macro that does it....


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
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
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
Hi Martin,

thank you for the detailled instructions.

Re your question

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

in Delphi/column mode, the caret moves one line down at each insert.

1. starting from this status


I click ctrl+O+C for column mode

2. I select the text 'peppe'+blank then ctrl-c to save the text into memory 


3. using the arrow keys, I move the caret 2 lines down...


4. after I press ctrl-v, the caret moves 1 line down. This is exactly what I miss in Lazarus :)  


I will try to fix the point.

Thank you

Duilio


On Sun, Feb 21, 2021 at 12:30 PM Martin Frb <[hidden email]> wrote:
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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sun, Feb 21, 2021 at 1:30 PM Martin Frb via lazarus <[hidden email]> wrote:
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.

This particular feature should not have an option IMO.
Now it can be considered a missing feature or even a bug.
When a user presses Alt-key when selecting, he clearly wants something special to happen with Ctrl-C.
Now nothing special happens which is a semi-bug.
I am sure everybody will be happy when this feature gets implemented. I can remember many situations where it would have been useful.

IMO there are too many options already.
If I accidentally change something during my tests, it takes a long time to figure out what changed and how to revert it.
Please add more options only when really needed.

Juha


--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

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

Free Pascal - Lazarus mailing list
On 21/02/2021 16:53, Juha Manninen via lazarus wrote:
On Sun, Feb 21, 2021 at 1:30 PM Martin Frb via lazarus <[hidden email]> wrote:
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.

This particular feature should not have an option IMO.
Now it can be considered a missing feature or even a bug.
When a user presses Alt-key when selecting, he clearly wants something special to happen with Ctrl-C.

Well, if the user selects a column selection of a single line, then yes (probably).

But if the user selects column over several lines, then pasting already acts different than it would for a normal selection.
(Select 3 full lines (start to end) using column selection => paste will be different than the same 3 lines in normal selection)
 
And users who grew up without the feature may not like it.

Now nothing special happens which is a semi-bug.
I am sure everybody will be happy when this feature gets implemented. I can remember many situations where it would have been useful.
I don't have an example at hand, but I am sure I have more than a few times made the experience that small, seemingly really useful changes got someone coming up wanting the old behaviour back.


IMO there are too many options already.
That is true, or rather they are badly organized. They need break down into basic, and expert (like the mouse options have)

If I accidentally change something during my tests, it takes a long time to figure out what changed and how to revert it.
Take a copy of your ___Options.xml files.
You can restore or diff them.

Please add more options only when really needed.

What I really would want to do, is include config in the keymap.
You could add new commands to the keymap.

So you would assign ctrl-v to
    paste(true)
or
   paste(ColumnAdvanceLine)
   ecPaste(ColumnAdvanceLine, IndentToContext, TabsToSpaces)

They look like pascal script, but they would not require pascalscript. (PascalScript does not work on all platforms, so it can not be used here)
They would always be a single command, with hardcoded options.

This is like in some browser, you can do config in css, JavaScript or similar.

But that is a topic on its own.



--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus