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

Sounds like old scripts

`Split-line(s).lua`:
```lua
-- Split line(s) by specified character(s)

local sDelim = geany.input("Delimiter:", ",")
if sDelim == nil then return end
if sDelim == "\\t" then sDelim = "\t" end

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

local iStart, iStop = geany.select()
local iCurPos
if iStart <= iStop then
  iCurPos = iStart
else
  iCurPos = iStop
end
local iLine, iColumn = geany.rowcol(iCurPos)

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 sRes = ""
local n1, n2, n3 = 1, 1, 1
while true do
  n1, n2 = string.find(sText, sDelim, n3, true)
  if n1 ~= nil then
    sRes = sRes .. string.sub(sText, n3, n1 - 1) .. sEOL
  else
    sRes = sRes .. string.sub(sText, n3, -1)
    break
  end
  n3 = n2 + 1
end

if bFullText == true then
  geany.text(sRes)
else
  geany.selection(sRes)
end
iCurPos = geany.rowcol(iLine, 0)
geany.select(iCurPos)
```

`Concatenate-lines-(by-spaces).lua`:
```lua
-- Replace \r\n on space

local s = geany.selection()
if s == nil then
  geany.message("Concatenate lines (by spaces)", "There is no open document!")
elseif s == "" then
  geany.message("Concatenate lines (by spaces)", "No text is selected!")
else
  -- SCI_GETEOLMODE
  local em = geany.scintilla(2030)
  -- SC_EOL_CRLF
  if em == 0 then
    s = string.gsub(s, '\r\n', ' ')
  else
    s = string.gsub(s, '[\r\n]', ' ')
  end
  geany.selection(s)
end
```

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

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

Reply via email to