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

Solved bugs are moved into this topic...
Post Reply
tmsg
Posts: 120
Joined: 20.05.2020 12:08

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

Post 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:
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post 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
tmsg
Posts: 120
Joined: 20.05.2020 12:08

Post 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.
tmsg
Posts: 120
Joined: 20.05.2020 12:08

Post 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 :?: :?: :?:
Alexey
Posts: 1633
Joined: 05.10.2012 22:10

Post by Alexey »

tmsg
Posts: 120
Joined: 20.05.2020 12:08

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