In theory:

local function GetEmptyLines(sLE, iLE)
  local sR = ""
  for i = 1, iLE do sR = sR .. sLE end
  return sR
end

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

local iCurPos = geany.caret()
local iL, iC = geany.rowcol(iCurPos)
iCurPos = geany.scintilla("SCI_GETLINEENDPOSITION", iL - 1)
geany.caret(iCurPos)
geany.selection(sAdd)
geany.caret(iCurPos + string.len(aEOL[iEOL + 1]))
local function GetEmptyLines(sLE, iLE)
  local sR = ""
  for i = 1, iLE do sR = sR .. sLE end
  return sR
end

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

local iLines = geany.height()
local sTxt = geany.text()
geany.text(sTxt .. sAdd)
local iCurPos = geany.rowcol(iLines + 1, 0)
geany.caret(iCurPos)

It seems, the second script did not work correctly:

local iCurPos = geany.rowcol(iLines + 1, 0)

but in this moment, the line with the number iLines + 1 does not yet exist.

P.S.

I do not think I ever heard it called a “caret” before.

"Cursor" can be either a "text cursor" or a "mouse cursor", maybe this is the reason? In any case, this word is an adequate word and can be seen in the documentation of various projects.


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/4091/comments/11628236@github.com>