Skip to content

Commit

Permalink
fix(lua): corrector.lua now clears specific cand.comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mirtlecn committed Apr 18, 2024
1 parent dc4f52d commit 62f3e10
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 5 deletions.
3 changes: 3 additions & 0 deletions double_pinyin.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ translator:
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([bpmnljqxy])n/$1in/
- xform/(\w)g/$1eng/
Expand Down
3 changes: 3 additions & 0 deletions double_pinyin_abc.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ translator:
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/o(\w)/0$1/
- xform/(\w)q/$1ei/
Expand Down
3 changes: 3 additions & 0 deletions double_pinyin_flypy.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ translator:
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([bpmfdtnljqx])n/$1iao/
- xform/(\w)g/$1eng/
Expand Down
3 changes: 3 additions & 0 deletions double_pinyin_mspy.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ translator:
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([aoe])(\w)/0$2/
- xform/([bpmnljqxy])n/$1in/
Expand Down
3 changes: 3 additions & 0 deletions double_pinyin_sogou.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ translator:
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([aoe])(\w)/0$2/
- xform/([bpmnljqxy])n/$1in/
Expand Down
3 changes: 3 additions & 0 deletions double_pinyin_ziguang.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ translator:
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/o(\w)/0$1/ # 零聲母先改爲0,以方便後面的轉換
- xform/([jqxy])n/$1ue/ # 提前轉換雙拼碼 n 和 g,因爲轉換後的拼音裏就快要出現這兩個字母了,那時將難以分辨出雙拼碼
Expand Down
13 changes: 8 additions & 5 deletions lua/corrector.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,14 @@ end
function M.func(input)
for cand in input:iter() do
-- cand.comment 是目前输入的词汇的完整拼音
local c = M.corrections[cand.comment]
if c and cand.text == c.text then
cand:get_genuine().comment = string.gsub(M.style, "{comment}", c.comment)
elseif cand.type == "user_phrase" or cand.type == "phrase" or cand.type == "sentence" then
cand:get_genuine().comment = ""
local pinyin = cand.comment:match("^[(.-)]$")
if pinyin and #pinyin > 0 then
local c = M.corrections[pinyin]
if c and cand.text == c.text then
cand:get_genuine().comment = string.gsub(M.style, "{comment}", c.comment)
else
cand:get_genuine().comment = ""
end
end
yield(cand)
end
Expand Down
3 changes: 3 additions & 0 deletions rime_ice.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,9 @@ translator:
spelling_hints: 8 # corrector.lua :为了让错音错字提示的 Lua 同时适配全拼双拼,将拼音显示在 comment 中
always_show_comments: true # corrector.lua :Rime 默认在 preedit 等于 comment 时取消显示 comment,这里强制一直显示,供 corrector.lua 做判断用。
initial_quality: 1.2 # 拼音的权重应该比英文大
comment_format: # 标记拼音注释,供 corrector.lua 做判断用
- xform/^/[/
- xform/$/]/
preedit_format: # preedit_format 影响到输入框的显示和“Shift+回车”上屏的字符
- xform/([jqxy])v/$1u/ # 显示为 ju qu xu yu
# - xform/([nl])v/$1ü/ # 显示为 nü lü
Expand Down

1 comment on commit 62f3e10

@rebron1900
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

原来是bug,我还是我的使用问题。

Please sign in to comment.