Case-sensitive search is usually faster and I added matchcase
out of habit :) In your case, this option will not interfere, but if you want, you can use an empty value (i.e. {}
) instead and geany.find
will ignore the case of characters.
If we try to simplify it as much as possible, we'll probably get something like this:
next:
local iCurPos = geany.caret()
local iS, iE = geany.find("##########################", iCurPos + 1, geany.length(), {"matchcase"})
if iS ~= nil then
geany.select(iS, iE)
else
geany.message("Not found.")
end
previous:
local iCurPos = geany.caret()
local iS, iE = geany.find("##########################", iCurPos - 1, 0, {"matchcase"})
if iS ~= nil then
geany.select(iS, iE)
else
geany.message("Not found.")
end
I use iCurPos + 1
and iCurPos - 1
so that the search does not capture the text in the current position (when we have "CURSOR##########################" or "##########################CURSOR"). It sounds logical, but I'm not sure if it's really necessary :)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.