Newlines in search and replace

Post any comments, suggestions, annoyances or ideas for future releases here. Please do not post bug reports or questions here.
Post Reply
AaronNGray
Posts: 13
Joined: Sat Dec 22, 2007 8:41 pm

Newlines in search and replace

Post 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
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
AaronNGray
Posts: 13
Joined: Sat Dec 22, 2007 8:41 pm

Post by AaronNGray »

Great, thanks alot Jussi, this is great news, I will give it a proper testing later today.

Aaron
AaronNGray
Posts: 13
Joined: Sat Dec 22, 2007 8:41 pm

Post 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
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
AaronNGray
Posts: 13
Joined: Sat Dec 22, 2007 8:41 pm

Post 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
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
jussij
Site Admin
Posts: 2650
Joined: Fri Aug 13, 2004 5:10 pm

Post 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
Post Reply