Bug 129494 - incorrect global replace -- %s///g
Summary: incorrect global replace -- %s///g
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-20 17:08 UTC by Maciej Pilichowski
Modified: 2010-02-16 12:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
downloaded test file (47.89 KB, text/plain)
2006-06-20 17:10 UTC, Maciej Pilichowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Maciej Pilichowski 2006-06-20 17:08:28 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    SuSE RPMs

I try to replace all the 
|
by newlines. The attached file has 175 occurrences of | however kate at first can find only 170 of them. 

Try this at the command line:
%s/\|/\n/g

once, and then again. Attached file is a plain text file, encodings -- CodePage1250.
Comment 1 Maciej Pilichowski 2006-06-20 17:10:32 UTC
Created attachment 16716 [details]
downloaded test file
Comment 2 Thiago Macieira 2006-06-27 23:42:22 UTC
"175 replacements made"

Worked just fine here (r548000).
Comment 3 Dominik Haumann 2006-06-28 00:09:13 UTC
Here it only finds 150 (KDE 3.5.3).
Comment 4 Maciej Pilichowski 2006-06-28 10:05:31 UTC
How can I find out what r-number I have?
Comment 5 Erlend Hamberg 2010-02-15 15:48:25 UTC
confirmed in kde 4.4. it seems like it gets confused by new lines being added.

a simpler test case:

foo foo
foo

%s/foo/bar/g will only replace the two occurrences on the first line, and not touch the second line (which will be the fourth line after replacing the two “foo”s on the first line)
Comment 6 Erlend Hamberg 2010-02-16 02:31:28 UTC
SVN commit 1090796 by ehamberg:

take added lines into account when replacing a pattern with newline(s)

BUG: 129494

 M  +10 -2     katecmds.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1090796
Comment 7 Erlend Hamberg 2010-02-16 12:31:53 UTC
SVN commit 1090936 by ehamberg:

backport of 1090796:
take added lines into account when replacing a pattern with newline(s)           

CCBUG: 129494



 M  +10 -2     katecmds.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1090936