Skip to content

Commit 3aa2ba7

Browse files
authored
feat: 添加小键盘数字处理器(kp_number_processor) (#275)
- 新增 lua/kp_number_processor.lua 小键盘数字处理脚本 - default.yaml 中添加小键盘按键映射(0-9、小数点、加减乘除、回车) - rime_mint.schema.yaml 和 double_pinyin.schema.yaml 中添加 kp_number_processor 到 processors
1 parent f1d90d6 commit 3aa2ba7

4 files changed

Lines changed: 432 additions & 0 deletions

File tree

default.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,25 @@ key_binder:
163163
- { when: always, accept: Control+Shift+5, toggle: extended_charset } # 切换扩展字符
164164
- { when: always, accept: Shift+space, toggle: full_shape } # 另一种切换全角/半角的方式
165165
- { when: always, accept: Control+period, toggle: ascii_punct } # 切换中/西文标点
166+
# 将小键盘 0~9 . 映射到主键盘,数字金额大写的 Lua 如 R1234.5678 可使用小键盘输入
167+
- {accept: KP_0, send: 0, when: composing}
168+
- {accept: KP_1, send: 1, when: composing}
169+
- {accept: KP_2, send: 2, when: composing}
170+
- {accept: KP_3, send: 3, when: composing}
171+
- {accept: KP_4, send: 4, when: composing}
172+
- {accept: KP_5, send: 5, when: composing}
173+
- {accept: KP_6, send: 6, when: composing}
174+
- {accept: KP_7, send: 7, when: composing}
175+
- {accept: KP_8, send: 8, when: composing}
176+
- {accept: KP_9, send: 9, when: composing}
177+
- {accept: KP_Decimal, send: period, when: composing}
178+
# 将小键盘 + - * / 映射到主键盘,使计算器 如 1+2-3*4 可使用小键盘输入
179+
- {accept: KP_Multiply, send: asterisk, when: composing}
180+
- {accept: KP_Add, send: plus, when: composing}
181+
- {accept: KP_Subtract, send: minus, when: composing}
182+
- {accept: KP_Divide, send: slash, when: composing}
183+
# 将小键盘回车映射到主键盘回车
184+
- {accept: KP_Enter, send: Return, when: composing}
166185

167186
recognizer:
168187
# 定义识别码的正则表达式规则

double_pinyin.schema.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ switches:
4141

4242
engine:
4343
processors:
44+
- lua_processor@*kp_number_processor
4445
- lua_processor@*select_character # 以词定字
4546
- lua_processor@*codeLengthLimit_processor # 使用Lua限制输入内容的最大长度(防止过长而卡顿)
4647
- ascii_composer # ※ 處理西文模式及中西文切換

0 commit comments

Comments
 (0)