-- Converting selected text to UPPER case (Ctrl+Shift+U), lower case (Ctrl+U) -- and inverting between the cases (Ctrl+I) -- (because the build-in functions does not recognizing cyrillic characters) -- To use it just add the code bellow ("ChangeCase" function) to the SciTEStartup.lua file -- also add the following part to your .properties file: -- ========================================================= -- command.name.1.*= -- command.1.*=ChangeCase U -- command.mode.1.*=subsystem:lua,savebefore:no -- -- command.name.2.*= -- command.2.*=ChangeCase L -- command.mode.2.*=subsystem:lua,savebefore:no -- -- command.name.3.*= -- command.3.*=ChangeCase I -- command.mode.3.*=subsystem:lua,savebefore:no -- -- user.shortcuts=\ -- Ctrl+Shift+U|1111|Ctrl+Shift+Ã|1111|\ -- Ctrl+U|1112|Ctrl+Ã|1112|\ -- Ctrl+I|1113|Ctrl+Ø|1113| -- ========================================================= -- * Where 1111,1112,1113 is the command.number + 1100 (MenuID?). -- * The russian shortcuts is to make it work when this keyboard layot is used, can be ommited. -- * The names are missed to prevent they appearing in the Tools menu. ------------------------------------------------------------------------- function ChangeCase(case) local str = editor:GetSelText() local res = '' local sel_start = editor.SelectionStart local sel_end = editor.SelectionEnd if str ~= nil then for i = 1, string.len(str) do local strS = string.sub(str,i,i) local strB = string.byte(strS,1) if case ~= 'U' and (strB > 191 and strB < 224) then --// [À-ß] res = res..string.char(strB + 32) elseif case ~= 'U' and (strB == 161 or strB == 178) then -- // ¡ ² res = res..string.char(strB + 1) elseif case ~= 'L' and (strB > 223 and strB <= 255) then --// [à-ÿ] res = res..string.char(strB - 32) elseif case ~= 'L' and (strB == 162 or strB == 179) then -- // ¢ ³ res = res..string.char(strB - 1) elseif case ~= 'U' and (strB > 64 and strB < 91) then --// [A-Z] res = res..string.lower(strS) elseif case ~= 'L' and (strB > 96 and strB < 123) then --// [a-z] res = res..string.upper(strS) else res = res..strS end end end editor:ReplaceSel(res) editor:SetSel(sel_start, sel_end) end