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_:
```lua
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_:

```lua
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 or view it on GitHub:
https://github.com/geany/geany/discussions/4171#discussioncomment-11712596
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/repo-discussions/4171/comments/[email protected]>

Reply via email to