1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
--
-- SPDX-FileCopyrightText: 2020 Weng Xuetian <wengxt@gmail.com>
--
-- SPDX-License-Identifier: LGPL-2.1-or-later
--
local fcitx = require("fcitx")
fcitx.log("ABCD");
fcitx.watchEvent(fcitx.EventType.KeyEvent, "key_logger")
fcitx.addConverter("convert")
function key_logger(sym, state, release)
if state == fcitx.KeyState.Ctrl then
print(fcitx.currentInputMethod())
end
return false
end
function convert(str)
print("Convert called")
str = string.gsub(str, "([abc])", string.upper)
return str
end
function testProgram()
return fcitx.currentProgram()
end
function testInputMethod()
return fcitx.currentInputMethod()
end
function testInvoke(config)
if type(config) == "string" then
assert(config == "ABC")
return "DEF"
end
print(fcitx.dump(config))
config["B"] = {
C = "5",
D = "6",
E = {
F = "7",
G = "8",
}
}
return config
end
function testUtf16Conversion(str)
fcitx.log(str);
return fcitx.UTF8ToUTF16(str)
end
function testUtf8Conversion(str)
return fcitx.UTF16ToUTF8(str)
end
|