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

@advice2020

> This script was not designed for this but tried running with no selection in 
> a document with many lines. Adds "PREFIX " and " SUFFIX" to every line in 
> document :)

It makes sense, doesn't it? :)

> I was wondering would it be possible for the script to be able to just apply 
> the prefix / suffix to just the single word that the caret is currently in?

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

local sPrefix = ""
local sSuffix = ""

local n0 = geany.caret()
local n1 = geany.scintilla("SCI_WORDSTARTPOSITION", n0, true)
local n2 = geany.scintilla("SCI_WORDENDPOSITION", n0, true)

geany.select(n1, n2)
local sWord = geany.selection()
if (sWord == nil) or (sWord == "") then
  geany.message("Fail.")
  return
end
geany.selection(sPrefix .. sWord .. sSuffix)
```
But see [word 
chars](https://plugins.geany.org/geanylua/geanylua-ref.html#wordchars)!

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

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

Reply via email to