Page 1 of 1

Newlines in search and replace

Posted: Sat Dec 22, 2007 8:48 pm
by AaronNGray
This is also a missing feature that makes some edits very tiresomeor next to impossible. I use a different editor to do these types of edits.

Aaron

Posted: Sun Dec 23, 2007 2:03 am
by jussij
Unfortunately Zeus does not have the ability to search for and replace the end of line character :(

This is a limitation of the Zeus design more than anything :(

Cheers Jussi

Posted: Mon Mar 31, 2008 11:52 pm
by jussij
This feature has now been added to Zeus :)

To get this feature just download the latest Zeus patch found here: http://www.zeusedit.com/forum/viewtopic.php?t=1790

Cheers Jussi

Posted: Tue Apr 01, 2008 5:09 pm
by AaronNGray
Great, thanks alot Jussi, this is great news, I will give it a proper testing later today.

Aaron

Posted: Tue Apr 01, 2008 5:30 pm
by AaronNGray
Jussi,

Heres some tests :-

\n\n -> \n
\n -> \n\n

work fine.

\n+ -> \n seems to be non greedy where really it should be greedy

\n* -> \n does not work correctly it seems to be eating other characters

Thanks,

Aaron

Posted: Tue Apr 01, 2008 11:53 pm
by jussij
Because Zeus holds each line in a separate line buffer and does not actually store the \n line feed character, when a \n search is requested it creates a special search line buffer made up of a number of concatenated lines separated by line feeds.

To determine how many lines need to be concatenated it counts the number of \n characters specified in the search string.

So for example, because the \n+ search string contains one \n, then only two lines will be concatenated, and hence on two lines will be found.

As for the \n* search, I am not sure what is going on there, since the regexp engine seams to be always return any single character rather than zero or more line feeds :?:

This looks like a bug in the regexp engine itself, since the a* search seems to return a similarly broken result :(

Cheers Jussi

Posted: Wed Apr 02, 2008 1:46 pm
by AaronNGray
Jussi,

I was using the text :-

~~~~
test

test


test



test




~~~~

which \n+ -> \n should really turn into :-

test
test
test
test

rather than having to run the replace operation n times.

Aaron

Posted: Wed Apr 02, 2008 10:27 pm
by jussij
Hi Aaron,

I do understand your bug report, but because of the reasons describe above, there are limitations to what Zeus can do :(

So while it is not working as expected, it is working to design ;)

Having said this, the situation can be improved by increasing the minimum size of the search line buffer, but the search will still be limited by design, meaning there will always be a situation where the search and replace does not work as expected.

Cheers Jussi

Posted: Sat Aug 16, 2008 5:07 am
by jussij
The latest version should do a better job of handling the \n+ case ;)

The latest patch can be found here: http://www.zeusedit.com/forum/viewtopic.php?p=3976

Cheers Jussi