You are here: PSPad forum > English discussion forum > Re: Bug in "Replace"

Re: Bug in "Replace"

#1 Bug in "Replace"

Posted by: garbuya | Date: 2015-07-23 18:21 | IP: IP Logged

1. Select group of lines
2. Press Ctrl+H
3. Select "Start of line" in "Find"
4. Type something in "Replace"
5. Click OK

First line after selection is also updated

I want to add # in front of 3 selected lines
A
B
C

D

The result is
#A
#B
#C
#D

Options: Reply | Quote | Up ^


#2 Re: Bug in "Replace"

Posted by: pspad | Date: 2015-07-23 19:18 | IP: IP Logged

Did you selected begin of the fourth line too? I don't know your search expression, but if you selected 3 lines only (cutrsor will stop on the end of the 3rd line), replace will be OK

Options: Reply | Quote | Up ^


#3 Re: Bug in "Replace"

Posted by: garbuya | Date: 2015-07-23 20:37 | IP: IP Logged

No, I'm selecting exactly 3 lines by positioning cursor at the beginning of line and using Shift+DownArrow
If you select using mouse then it works OK only if last line is not fully selected. But if you select full 3 lines then 4th line also be modified

PsPad ver 4.6.0(2665)

Edited 2 time(s). Last edit at 2015-07-23 20:38 by garbuya.

Options: Reply | Quote | Up ^


#4 Re: Bug in "Replace"

Posted by: garbuya | Date: 2015-07-23 20:55 | IP: IP Logged

image

Options: Reply | Quote | Up ^


#5 Re: Bug in "Replace"

Posted by: vbr | Date: 2015-07-23 21:32 | IP: IP Logged

Hi,
I believe, this behaviour is correct for the mentioned pattern - if the preceding end of line is selected and the caret is at the beginning of the fourth line, ^ also matches this position.
You can either stop the selection at the previous line, as you noticed, or modify the pattern to reflect further characters, e.g. replacing:
^(.)
with:
-$1
works according to your requirement (for A, B, C lines, even with selection ending just before D).

For this special case - prepending some fixed text at certain position of (selected) lines, you may even use a dedicated function
Edit: Lines manipulation: Insert text into lines... (Alt+I)

hth,
vbr

Options: Reply | Quote | Up ^


#6 Re: Bug in "Replace"

Posted by: pspad | Date: 2015-07-24 05:12 | IP: IP Logged

garbuya:
No, I'm selecting exactly 3 lines by positioning cursor at the beginning of line and using Shift+DownArrow
If you select using mouse then it works OK only if last line is not fully selected. But if you select full 3 lines then 4th line also be modified

PsPad ver 4.6.0(2665)

Sorry, but you have selected 4 lines. You started with curso on the 1 positions, but you ended with cursor on the 4th line 1st position.
You are searchich for begin of the line, so PSPad include your forth line too.

Try the same, but end with cursor somewhere inside the 3rd line

Options: Reply | Quote | Up ^


#7 Re: Bug in "Replace"

Posted by: garbuya | Date: 2015-07-24 13:35 | IP: IP Logged

Quote:
Sorry, but you have selected 4 lines. You started with curso on the 1 positions, but you ended with cursor on the 4th line 1st position.

It is very unusual behavior

If I, as user, highlighted some lines, I expect that only what I see highlighted will be processed.
And this is the normal behavior of any application -- WYSIWYG, "What You See Is What You Get".
Even if internally I selected something extra application should be smart enough to not to process it.

Don't you agree, that Editor should be a WYSIWYG application?

If I'm editing files all day long and do a "blind typing" I expect the results to be right without the need to look at the screen all the time and without any special tricks, especially if this trick required to switch keyboard to mouse every second.

Options: Reply | Quote | Up ^


#8 Re: Bug in "Replace"

Posted by: pspad | Date: 2015-07-24 14:30 | IP: IP Logged

Please understand. You marked 4 line starts. You replaced line starts with something.
It's logical, all marked line starts are replaced.

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR