Sign in Join

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

Mailing lists / lazarus / 2021-02

editor bug?

7 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

duilio foschi

I am using Lazarus v. 2.0.6 r. 62129 on windows 7/64 bits.

I found an unexpected behaviours of the editor

1. I want to delete the text ":string" from the encircled column-sized frame you see here:

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

The frame was selected using shift+alt+arrows keys.

2. when I click the ReplaceAll button also the text from the encircled button
here

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

is deleted, what is unexpected.

Isnt this a bug?

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

Reply by email

Martin Frb
to duilio foschi
duilio foschi wrote 22 lines
I am using Lazarus v. 2.0.6 r. 62129 on windows 7/64 bits. I found an unexpected behaviours of the editor 1. I want to delete the text ":string" from the encircled column-sized frame you see here: https://i.ibb.co/V9ZPzSf/1.jpg <https://i.ibb.co/V9ZPzSf/1.jpg> The frame was selected using shift+alt+arrows keys. 2. when I click the ReplaceAll button also the text from the encircled button here https://i.ibb.co/dpFsjNq/2.jpg <https://i.ibb.co/dpFsjNq/2.jpg> is deleted, what is unexpected. Isnt this a bug?

Yes it is.

This is not currently implemented, so the Search/Replace should not allow "in selection"

You can report it (the unimplemented fearture) as a bug. But it will be rather some time until that might get implemented (unless someone contributes).

----------------
There are some other options to archive what you need.

Multi caret mode: (you can in Keymap config a key to have all carets kept, when moving them in any direction)
https://wiki.lazarus.freepascal.org/New_IDE_features_since#Multi_Caret

Maybe
https://wiki.lazarus.freepascal.org/New_IDE_features_since#Syncron-Edit

And Editor Macros
record actions for one line, end with positioning one line down => then play macro repeatedly.

Reply by email

duilio foschi
to Martin Frb

Hi Martin,

somebody fixed the bug.

You will find a zip file at this link:
https://mega.nz/file/T85iARDY#kK9i6JbM-aDJfRafL5PMN2MenSfxJoK4Yg9tnVwGsTo

The zip file contains:

1. the corrected synedit.pp for Lazarus stable v. 2.0.12
2. the corrected synedit.pp for Lazarus trunk v. 2.1.0
3. the diff file for #1
4. the diff file for #2

I am not accustomed to version control software.

Please feel free to use the attached fix in the way you like

Thank you

Duilio
.

On Sat, Feb 20, 2021 at 2:51 PM Martin Frb via lazarus <

Show quoted text 53 lines
wrote: On 20/02/2021 10:58, duilio foschi via lazarus wrote: > I am using Lazarus v. 2.0.6 r. 62129 on windows 7/64 bits. > > I found an unexpected behaviours of the editor > > 1. I want to delete the text ":string" from the encircled column-sized > frame > you see here: > > https://i.ibb.co/V9ZPzSf/1.jpg <https://i.ibb.co/V9ZPzSf/1.jpg> > > The frame was selected using shift+alt+arrows keys. > > 2. when I click the ReplaceAll button also the text from the encircled > button > here > > https://i.ibb.co/dpFsjNq/2.jpg <https://i.ibb.co/dpFsjNq/2.jpg> > > is deleted, what is unexpected. > > Isnt this a bug? > Yes it is. This is not currently implemented, so the Search/Replace should not allow "in selection" You can report it (the unimplemented fearture) as a bug. But it will be rather some time until that might get implemented (unless someone contributes). ---------------- There are some other options to archive what you need. Multi caret mode: (you can in Keymap config a key to have all carets kept, when moving them in any direction) https://wiki.lazarus.freepascal.org/New_IDE_features_since#Multi_Caret Maybe https://wiki.lazarus.freepascal.org/New_IDE_features_since#Syncron-Edit And Editor Macros record actions for one line, end with positioning one line down => then play macro repeatedly. -- _______________________________________________ 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/20210315/2797f747/attachment.html>

Reply by email

Martin Frb
to duilio foschi: somebody fixed the bug. You will find a zip file at this link:…
duilio foschi wrote 16 lines
You will find a zip file at this link: https://mega.nz/file/T85iARDY#kK9i6JbM-aDJfRafL5PMN2MenSfxJoK4Yg9tnVwGsTo <https://mega.nz/file/T85iARDY#kK9i6JbM-aDJfRafL5PMN2MenSfxJoK4Yg9tnVwGsTo> The zip file contains: 1. the corrected synedit.pp for Lazarus stable v. 2.0.12 2. the corrected synedit.pp for Lazarus trunk v. 2.1.0 3. the diff file for #1 4. the diff file for #2 I am not accustomed to version control software. Please feel free to use the attached fix in the way you like

First of all, thanks for the patch.
Please only sent patches, the full files are not needed (and quickly outdated in case of trunk).
Ideally go to https://bugs.freepascal.org/ register and submit your patch with a new issue. I can not always deal with patches immediately, and in my mail inbox they can get lost very quickly. Once you opened an issue, you can link to it, when you sent an email.

Patches against trunk are the correct way.
Other than getting trunk, there is no need to deal with svn or any revision management system.

Besides the issues described below, your patch was very helpful, as it pointed me to the correct location for the fix. And it's review brought up more issues that need/needed fixing.

------------------------------------
About the patch itself.

Both of the issues below, had been present before your patch. So they are not a result of your patch.
I have fixed the first of the 2 issues, and committed this to trunk 2.1

***1)
If the text contains tabs, or special chars (such as umlauts äöü, accents, Japanese, Arabic, ....) then it can fail.

X (in the search code) is a byte position into the string. It is not a position on the screen.
https://wiki.lazarus.freepascal.org/SynEdit#Logical.2FPhysical_caret_position

Consider those Lines:  . for spaces,  \t shall be a tab, with tab-width = 4

........ab cd ef gh  // 8 spaces "cd" is at x=12
ääääööööab cd ef gh // 8 umlauts (each 2 bytes) "cd" is at x=20 \t\tab cd ef gh  // 2 tabs (same width as spaces) "cd" is at x=6 ........ab cd ef gh  // 8 spaces "cd" is at x=12

However, the "cd" on each line are aligned on the screen. So you can have a column selection, that in each line has "cd ef g" If in that column selection you replace "ef" with "EF", then your ptStartX=12 and ptEndX=19 => will replace nothing in the 2 middle lines.

***2)
Further more, if the text to be replaced occurs twice on a line ........ab cd cd ef gh
and "cd" is replaced by "CB and more", then the 2nd "cd" may get pushed out of the range, before being replaced.

This is not yet fixed.
According to me test this is "compatible" with Delphi 10.3 (I.e. it seems to be not working in Delphi too)

Reply by email

duilio foschi
to Martin Frb

I have made the patches for myself.

Please do what you like with them.

Thank you

Duilio.

On Tue, Mar 16, 2021 at 9:42 PM Martin Frb via lazarus <

Show quoted text 85 lines
wrote: On 15/03/2021 19:01, duilio foschi via lazarus wrote: > > You will find a zip file at this link: > https://mega.nz/file/T85iARDY#kK9i6JbM-aDJfRafL5PMN2MenSfxJoK4Yg9tnVwGsTo > < https://mega.nz/file/T85iARDY#kK9i6JbM-aDJfRafL5PMN2MenSfxJoK4Yg9tnVwGsTo> > > The zip file contains: > > 1. the corrected synedit.pp for Lazarus stable v. 2.0.12 > 2. the corrected synedit.pp for Lazarus trunk v. 2.1.0 > 3. the diff file for #1 > 4. the diff file for #2 > > I am not accustomed to version control software. > > Please feel free to use the attached fix in the way you like > First of all, thanks for the patch. Please only sent patches, the full files are not needed (and quickly outdated in case of trunk). Ideally go to https://bugs.freepascal.org/ register and submit your patch with a new issue. I can not always deal with patches immediately, and in my mail inbox they can get lost very quickly. Once you opened an issue, you can link to it, when you sent an email. Patches against trunk are the correct way. Other than getting trunk, there is no need to deal with svn or any revision management system. Besides the issues described below, your patch was very helpful, as it pointed me to the correct location for the fix. And it's review brought up more issues that need/needed fixing. ------------------------------------ About the patch itself. Both of the issues below, had been present before your patch. So they are not a result of your patch. I have fixed the first of the 2 issues, and committed this to trunk 2.1 ***1) If the text contains tabs, or special chars (such as umlauts äöü, accents, Japanese, Arabic, ....) then it can fail. X (in the search code) is a byte position into the string. It is not a position on the screen. https://wiki.lazarus.freepascal.org/SynEdit#Logical.2FPhysical_caret_position Consider those Lines: . for spaces, \t shall be a tab, with tab-width = 4 ........ab cd ef gh // 8 spaces "cd" is at x=12 ääääööööab cd ef gh // 8 umlauts (each 2 bytes) "cd" is at x=20 \t\tab cd ef gh // 2 tabs (same width as spaces) "cd" is at x=6 ........ab cd ef gh // 8 spaces "cd" is at x=12 However, the "cd" on each line are aligned on the screen. So you can have a column selection, that in each line has "cd ef g" If in that column selection you replace "ef" with "EF", then your ptStartX=12 and ptEndX=19 => will replace nothing in the 2 middle lines. ***2) Further more, if the text to be replaced occurs twice on a line ........ab cd cd ef gh and "cd" is replaced by "CB and more", then the 2nd "cd" may get pushed out of the range, before being replaced. This is not yet fixed. According to me test this is "compatible" with Delphi 10.3 (I.e. it seems to be not working in Delphi too) -- _______________________________________________ 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/c9a473fa/attachment-0001.html>

Reply by email