Skif-off left a comment (geany/geany-plugins#1478) > so I assume that this 'geany.wordchars` is applied on a per script basis, not > a global setting that affects everything in Geany, is this correct?
`geany.wordchars` just allows to change the general/global Geany/Scintilla value for a specific (current) script. By default, "apple" is a "word" in Geany and "蘋果" is not a "word" in Geany: i.e. if you are using any non-Latin alphabet, the second script will not work correctly. But you can try to change the value and then restore it before exit, something like: ```lua local sWordDefault = geany.wordchars geany.wordchars = sWordDefault .. "áâàåãäçéêèëæœß" -- your code geany.wordchars = sWordDefault ``` In theory (it seems to me that I've tried something like this before, but it was a long time ago). Also you can change this list of symbols in the [Filetype configuration](https://www.geany.org/manual/current/index.html#filetype-configuration) (for a specific file type(s)), but I have a bad idea of all the possible consequences. > would it be easy to put this new "caret" based code, into the original script > you provided, replacing the entire document functionality this caret code? Maybe something like: ```lua -- (cross-platform) -- 2025.08.21 --[[ 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 sText = geany.selection() if sText == nil then geany.message("Fail.") return elseif sText == "" then local n0 = geany.caret() local n1 = geany.scintilla("SCI_WORDSTARTPOSITION", n0, true) local n2 = geany.scintilla("SCI_WORDENDPOSITION", n0, true) geany.select(n1, n2) sText = geany.selection() if (sText == nil) or (sText == "") then geany.message("Fail.") return end geany.selection(sPrefix .. sText .. sSuffix) return 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) geany.selection(sRes) ``` (I just merged them with minimal changes.) With `geany.wordchars` (in theory): ```diff @@ -34,8 +34,11 @@ return elseif sText == "" then local n0 = geany.caret() + local sWordDefault = geany.wordchars + geany.wordchars = sWordDefault .. "áâàåãäçéêèëæœß" local n1 = geany.scintilla("SCI_WORDSTARTPOSITION", n0, true) local n2 = geany.scintilla("SCI_WORDENDPOSITION", n0, true) + geany.wordchars = sWordDefault geany.select(n1, n2) sText = geany.selection() if (sText == nil) or (sText == "") then ``` P.S. If you are using the Status tab, you can try replacing the message windows with text in that tab (`geany.message(text)` -> `geany.status(text)`). -- Reply to this email directly or view it on GitHub: https://github.com/geany/geany-plugins/issues/1478#issuecomment-3211136210 You are receiving this because you are subscribed to this thread. Message ID: <geany/geany-plugins/issues/1478/[email protected]>
