Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2021-02

I say a little prayer (for the Lazarus editor)

14 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

duilio foschi

If the coder in charge of the editor reads this, I have a prayer for him:

1.

The text showed in

https://i.ibb.co/0FQV1L0/3.jpg

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

https://i.ibb.co/VmbVJtg/4.jpg

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

https://i.ibb.co/PWLfsn9/5.jpg

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

https://i.ibb.co/98Y9WnD/6.jpg

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

.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210220/35c50942/attachment.html>

Reply by email

R.Smith
to duilio foschi

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

duilio foschi wrote 49 lines
If the coder in charge of the editor reads this, I have a prayer for him: 1. The text showed in https://i.ibb.co/0FQV1L0/3.jpg <https://i.ibb.co/0FQV1L0/3.jpg> 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 https://i.ibb.co/VmbVJtg/4.jpg <https://i.ibb.co/VmbVJtg/4.jpg> 3. I press ctrl-V. The text ':string' is correctly copied into the expected position but... look at the cursor https://i.ibb.co/PWLfsn9/5.jpg <https://i.ibb.co/PWLfsn9/5.jpg> 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 https://i.ibb.co/98Y9WnD/6.jpg <https://i.ibb.co/98Y9WnD/6.jpg> This ability is a big plus for a coder...well... at least I remember I was using it often :) .

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210220/2e812cbf/attachment.html>

Reply by email

duilio foschi
to R.Smith

Hi Ryan,

not the same result IMHO.

1.
I column-select the text shown in

https://i.ibb.co/WpL6Rmz/1.jpg

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

https://i.ibb.co/zGqQPPT/2.jpg

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

https://i.ibb.co/v1FJqzg/3.jpg

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

4.

pic

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...

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 <

Show quoted text 70 lines
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 https://i.ibb.co/0FQV1L0/3.jpg 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 https://i.ibb.co/VmbVJtg/4.jpg 3. I press ctrl-V. The text ':string' is correctly copied into the expected position but... look at the cursor https://i.ibb.co/PWLfsn9/5.jpg 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 https://i.ibb.co/98Y9WnD/6.jpg This ability is a big plus for a coder...well... at least I remember I was using it often :) . -- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210220/e53a130f/attachment.html>

Reply by email

Martin Frb
to duilio foschi: If the coder in charge of the editor reads this, I have a prayer for him: 1. The text…
duilio foschi 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.

Reply by email

Martin Frb
to Martin Frb
Martin Frb wrote 7 lines
> > 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.

Reply by email

Martin Frb
to Martin Frb: Well there is no diff with regards to caret placement. If you do column select over more…
Martin Frb wrote 9 lines
> > 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
.....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210220/92ac6d98/attachment.html>

Reply by email

Martin Frb
to duilio foschi: not the same result IMHO. 1. I column-select the text shown in…
duilio foschi wrote 8 lines
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)

Show quoted text 10 lines
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....

Reply by email

duilio foschi
to Martin Frb

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

PM Martin Frb wrote 41 lines
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....

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210221/31fee2f4/attachment.html>

Reply by email

Martin Frb
to duilio foschi
duilio foschi wrote 15 lines
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

Reply by email

duilio foschi
to Martin Frb

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

https://i.ibb.co/jL30yFx/1.jpg

I click ctrl+O+C for column mode

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

https://i.ibb.co/99DH4gc/2.jpg

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

https://i.ibb.co/ZHGqZx3/3.jpg

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

https://i.ibb.co/ZT6LJdD/4.jpg

I will try to fix the point.

Thank you

Duilio

PM Martin Frb wrote 74 lines
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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210221/afaa7f0a/attachment.html>

Reply by email

Juha Manninen
to Martin Frb: Official: https://svn.freepascal.org/svn/lazarus/ For bugs and patches:…

On Sun, Feb 21, 2021 at 1:30 PM Martin Frb via lazarus <

Show quoted text 6 lines
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210221/a98b8aee/attachment-0001.html>

Reply by email

Martin Frb
to Juha Manninen
Juha Manninen wrote 15 lines
On Sun, Feb 21, 2021 at 1:30 PM Martin Frb via lazarus < <mailto:>> 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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210221/59eca867/attachment.html>

Reply by email

duilio foschi
to Martin Frb

Hi Martin

somebody fixed this point, too. See

https://mega.nz/file/SkwVwIaS#qC1UeaSGy2kLwEQTSl57CPIYJZY34LYdMQQh7zb9ruY

I am sending the unit synedit.pp fixed for both the stable and the trunk version.

I can finally work in column mode as I was accustomed to do in Delphi :)

HTH

Duilio

On Sun, Feb 21, 2021 at 5:22 PM Martin Frb via lazarus <

Show quoted text 76 lines
wrote: On 21/02/2021 16:53, Juha Manninen via lazarus wrote: On Sun, Feb 21, 2021 at 1:30 PM Martin Frb via lazarus < > 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 https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20210316/37617257/attachment.html>

Reply by email

Martin Frb
to duilio foschi
duilio foschi wrote 12 lines
Hi Martin somebody fixed this point, too. See https://mega.nz/file/SkwVwIaS#qC1UeaSGy2kLwEQTSl57CPIYJZY34LYdMQQh7zb9ruY <https://mega.nz/file/SkwVwIaS#qC1UeaSGy2kLwEQTSl57CPIYJZY34LYdMQQh7zb9ruY> I am sending the unit synedit.pp fixed for both the stable and the trunk version. I can finally work in column mode as I was accustomed to do in Delphi :)

Patch would be helpful (ideally at
https://bugs.freepascal.org/my_view_page.php )

Your trunk is a bit older, and I get over 300 changed lines, when I compare.

Reply by email