Page 1 of 1

Regex search: cannot find-prev; wrong pos for find-next

Posted: 25.05.2020 10:33
by tmsg
Searching a text (say "local") with regex disabled works as expected. However, enabling regexes has two unhappy consequences: 1) "Find prev" is not functional anymore and (worse) b) "Find next" ALWAYS continues the search from the last found location and not from the caret, ie "Find next" has found a "local" in line 512, I then move down to line 1024 (with a "local" in the next line, 1025), "Find next" then jumps back to line 514 where there's also a "local". Disable regexes and all is well. :shock:

Posted: 25.05.2020 14:35
by Alexey
hm, it was made by design, but maybe I need to re-think this. "Find prev" is not enabled in regex engine, sorry

Posted: 25.05.2020 15:00
by tmsg
Alexey wrote:hm, it was made by design, but maybe I need to re-think this.
By design? :o So imagine a really long source code file with say 3000 lines (I tried this with one that had 3100 lines). How could you search efficiently for a regex in this file if the regex matches many lines in the file but you know that what you're looking for is somewhere after line 2500? With regex off you just go to line 2500 and start searching from there. But with regex on? Many clicks until you even get to line 2500 :cry:
Alexey wrote:"Find prev" is not enabled in regex engine, sorry
Hm, that's certainly a limitation. Of the two editors I know pretty well Geany can't search regexes backwards, Akelpad can. Does "not enabled" mean it could be enabled somehow or that it's not doable at all with the regex engine you are using? This is probably not a huge problem but it still leaves me scratching my head.

Posted: 26.05.2020 17:09
by tmsg
Well, searching with regex enabled is almost unusable as it is. The problem explained in my first post has another unhappy consequence: once a regex search has reached the end of the file there's no way (I could find) how I can ever restart the search in the beginning. What I have to do is go into the Find dialog, disable regexes and search for something non-regex once. This resets the search position for regexes. Then I have to re-enable regexes and can continue searching... this strange behaviour can't possibly be by design :?: :?: :?:

Posted: 28.05.2020 12:40
by Alexey

Posted: 28.05.2020 13:52
by tmsg
@Alexey: So I did some very quick tests... both Find prev and searching from caret position (in both directions) now seem to work as I'd expect them to.

V good work :D :D