SkepticMystic / advanced-cursors

Apache License 2.0
100 stars 2 forks source link

"Next" doesn't work while "run" for the same regex does #8

Closed chrisgrieser closed 3 years ago

chrisgrieser commented 3 years ago

So I have this saved query to find me all heading

Screenshot 2021-10-24 18 55 06

When I Advanced cursors: run it works properly and selects all headings in the file. However, using Advanced cursors: next for the very same saved query, it does find anything

Screenshot 2021-10-24 18 54 57
SkepticMystic commented 3 years ago

Indeed... I have looked around a little, but couldn't immediately figure out the issue. I will keep trying when I am able

SkepticMystic commented 3 years ago

One solution, I think, is to swap start of line ^ with new line \n. This will catch all headings except one at the top of a note

SkepticMystic commented 3 years ago

But I'll obvs try solve the underlying issue :)

SkepticMystic commented 3 years ago

Edit: Adding the m flag to a regex query should allow this to work

> I see the issue. I run the regex against the entire content of the note. So there is only one start of line ^, the start of the entire note. > I previously had it set up to run the regex against each line, which would allow the behaviour you're looking for, but then that introduces the limitation of not being able to check for new lines \n. > And I think multi-line queries are more useful than start-of-line queries. So I think it will stay that way unless I find a middle-ground. The solution for now then, is to swap ^\n, knowing that the first line won't match