Skif-off left a comment (geany/geany-plugins#1478)

Maybe something like
```lua
-- (cross-platform)
-- 2025.07.11
--[[
https://github.com/geany/geany-plugins/issues/1478
]]

local function StringSplit(sdata, sdelim)
  local ares = {}
  local n1, n2, n3, c = 1, 1, 1, 1
  while true do
    n1, n2 = string.find(sdata, sdelim, n3, true)
    if n1 ~= nil then
      ares[c] = string.sub(sdata, n3, n1 - 1)
      c = c + 1
    else
      ares[c] = string.sub(sdata, n3, -1)
      break
    end
    n3 = n2 + 1
  end
  return ares
end

local sPrefix = ""
local sSuffix = ""

local aEOL = {"\r\n", "\r", "\n"}
local iEOL = geany.scintilla("SCI_GETEOLMODE")
local sEOL = aEOL[iEOL + 1]

local bFullText = false
local sText = geany.selection()
if sText == nil then
  geany.message("Fail.")
  return
elseif sText == "" then
  sText = geany.text()
  bFullText = true
end

local sTmp
local aText = StringSplit(sText, sEOL)
for i = 1, #aText do
  sTmp = sPrefix .. aText[i] .. sSuffix
  aText[i] = sTmp
end
local sRes = table.concat(aText, sEOL)
if bFullText == true then
  geany.text(sRes)
else
  geany.selection(sRes)
end
```
Simple (without _InputBox_), see lines 24 and 25.

P.S. 
[geanylua/examples/scripting/open-script.lua](https://github.com/geany/geany-plugins/blob/6ac3b4c7aac607607eda371cd49e3c6250289b05/geanylua/examples/scripting/open-script.lua).

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/issues/1478#issuecomment-3059846480
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/issues/1478/[email protected]>

Reply via email to