-- Переводит выделенный в редакторе текст в ВЕРХНИЙ (Ctrl+Shift+U), нижний регистр (Ctrl+U) -- и инвертирует регистр символов (Ctrl+I) -- (т.к. встроенная функция не понимает кириллицу) -- Для подключения добавьте код скрипта в свой файл SciTEStartup.lua -- и добавьте в свой файл .properties следующие строки: -- command.name.11.*=Перевести в ВЕРХНИЙ регистр -- command.11.*=ChangeCase U -- command.mode.11.*=subsystem:lua,savebefore:no -- command.shortcut.11.*=Ctrl+Shift+U -- command.name.12.*=Перевести В нижний Регистр -- command.12.*=ChangeCase L -- command.mode.12.*=subsystem:lua,savebefore:no -- command.shortcut.12.*=Ctrl+U -- command.name.13.*=ИнВерТироВать регистр -- command.13.*=ChangeCase I -- command.mode.13.*=subsystem:lua,savebefore:no -- command.shortcut.13.*=Ctrl+I ------------------------------------------------------------------------- function ChangeCase(case) local str = editor:GetSelText() local res = '' 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) end |