You want to search from the current position, but specify "from the beginning 
of the file to the end of the file" :)

Select text and try something like:
forward
```lua
local sFind = geany.selection()
if sFind == "" then
  geany.message("Did you forget to select any text?")
  return
end

local iFindStart
local iSelS, iSelE = geany.select()
if iSelS < iSelE then
  iFindStart = iSelE
else
  iFindStart = iSelS
end

local iS, iE = geany.find(sFind, iFindStart, geany.length(), {"matchcase"})
if iS ~= nil then
  geany.select(iS, iE)
else
  geany.message("Not found.")
end
```
backward
```lua
local sFind = geany.selection()
if sFind == "" then
  geany.message("Did you forget to select any text?")
  return
end

local iFindStart
local iSelS, iSelE = geany.select()
if iSelS < iSelE then
  iFindStart = iSelS
else
  iFindStart = iSelE
end

local iS, iE = geany.find(sFind, iFindStart, 0, {"matchcase"})
if iS ~= nil then
  geany.select(iS, iE)
else
  geany.message("Not found.")
end
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/discussions/4171#discussioncomment-11665004
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