Re: [Lazarus] editor bug?

2021-03-16 Thread Martin Frb via lazarus

On 16/03/2021 22:00, duilio foschi via lazarus wrote:

I have made the patches for myself.

Please do what you like with them.


Well as I said, it helped me fixing your issue, and a 2nd related issue 
(and one issue identified, but still open)


Here is what I did (and that will be in the 2.2 release):
https://github.com/User4martin/lazarus/commit/932f4524db99025245f1eda7dc2e6868f81fc266
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] editor bug?

2021-03-16 Thread duilio foschi via lazarus
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 <
lazarus@lists.lazarus-ide.org> 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
> lazarus@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] editor bug?

2021-03-16 Thread Martin Frb via lazarus

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 



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
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] editor bug?

2021-03-15 Thread Martin Frb via lazarus

On 15/03/2021 19:01, duilio foschi via lazarus wrote:

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:


Thanks, I will have a look, asap.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] editor bug?

2021-03-15 Thread duilio foschi via lazarus
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 <
lazarus@lists.lazarus-ide.org> 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 
> >
> > 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?
> >
> 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
> lazarus@lists.lazarus-ide.org
> https://lists.lazarus-ide.org/listinfo/lazarus
>
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] editor bug?

2021-02-20 Thread Martin Frb via lazarus

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 

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?


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
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] editor bug?

2021-02-20 Thread duilio foschi via lazarus
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
-- 
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus