Skip to content

一个关于 fcitx5-lua 插件的问题 #671

Answered by wengxt
ClarkQAQ asked this question in Q&A
Discussion options

You must be logged in to vote

QuickPhrase 的 handler 的返回值必须符合特殊的要求,并不是返回字符串。你的返回结果不被认可。

首先返回结果是一个 table ,其次返回的每一项都需要是一个三元组
{ 显示 , 提交, 类型 }

例如
{"A", "B", fcitx.QuickPhraseAction.Commit} 表示显示成 A ,提交成 B,类型是直接提交的候选词

其他还有一些特殊的类型,例如 fcitx.QuickPhraseAction.TypeToBuffer ,表示把候选继续输入到 quickphrase 的缓冲区中

fcitx.QuickPhraseAction.Break ,避免后续其他的 handler 处理

还有一些其他特殊的值的可以改变候选词按键类型之类,可以参考

https://github.com/fcitx/fcitx5-lua/blob/master/src/imeapi/imeapi.lua#L58

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ClarkQAQ
Comment options

Answer selected by wengxt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants