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

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

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, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <geany/geany/repo-discussions/4171/comments/11665004@github.com>