@advice2020, you misspelled my nickname :) I didn't receive the notification, I saw it by accident.

Maybe something like this (but I didn't check it)

local aTypes = {
{"Lua", ".lua", "--#####################################"},
{"",    ".txt", "######################################"},
{"XML", ".xml", "<!--#################################-->"}
}
local aFI = geany.fileinfo()
local sExt, sStr
for i = 1, #aTypes do
  if aTypes[i][1] == aFI.type then
    sStr = aTypes[i][3]
    break
  end
end
if sStr == nil then
  sExt = string.lower(aFI.ext)
  for i = 1, #aTypes do
    if aTypes[i][2] == sExt then
      sStr = aTypes[i][3]
      break
    end
  end
end
if sStr == nil then
  geany.status("Warning: Unknown file type!")
  return
end
local iEOL = geany.scintilla("SCI_GETEOLMODE")
local sLE
if iEOL == 0 then
  sLE = "\r\n"
elseif iEOL == 1 then
  sLE = "\r"
elseif iEOL == 2 then
  sLE = "\n"
else
  sLE = "\n"
end
local iCurPos = geany.caret()
local iL, iC = geany.rowcol(iCurPos)
iCurPos = geany.scintilla("SCI_POSITIONFROMLINE", iL - 1)
geany.select(iCurPos)
geany.selection(sStr .. sLE)

aTypes:

{"file type", "file extension", "string"}

where "file extension" with dot, "file type" - see filetype_extensions.conf (online).


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-plugins/issues/1384/2488726988@github.com>