Skip to content

Commit

Permalink
fix: 移除__inculde配置,优化字符限制Lua
Browse files Browse the repository at this point in the history
经过测试,__include和path的/+配置冲突,虽然可以使用/+/+进行补充。

Fix #28
  • Loading branch information
Mintimate committed Feb 26, 2024
1 parent 06e3ddf commit 90f6734
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
5 changes: 0 additions & 5 deletions code_limit.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions double_pinyin_flypy.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ switches:
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@*code_length_limit # 使用Lua限制输入内容的最大长度(防止过长而卡顿)
- ascii_composer # ※ 處理西文模式及中西文切換
- recognizer # ※ 與 matcher 搭配,處理符合特定規則的輸入碼,如網址、反查等
- key_binder # ※ 在特定條件下將按鍵綁定到其他按鍵,如重定義逗號、句號爲候選翻頁鍵
Expand Down Expand Up @@ -108,6 +109,8 @@ emoji_suggestion:
tips: all
inherit_comment: false

# 最大输入长度
code_length_limit: 25


# Lua 配置: 降低部分英语单词在候选项的位置。
Expand Down
7 changes: 6 additions & 1 deletion lua/code_limit.lua → lua/code_length_limit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,17 @@ local kRejected = 0 -- 输入法拒绝处理
local kAccepted = 1 -- 输入法接受处理,并由本processor处理
local kNoop = 2 -- 交由输入法下一个processor判断是否处理

function M.init(env)
local config = env.engine.schema.config
env.name_space = env.name_space:gsub('^*', '')
end

function M.func(key, env)
local ctx = env.engine.context
local config = env.engine.schema.config

-- 限制
local length_limit = config:get_string(env.name_space .."/length_limit")
local length_limit = config:get_string(env.name_space)
if(length_limit~=nil) then
if(string.len(ctx.input) > tonumber(length_limit)) then
-- ctx:clear()
Expand Down
1 change: 0 additions & 1 deletion rime.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ time_translator = require("time")
date_translator = require("date")
week_translator = require("week")
number_translator = require("number_translator")
code_length_limit_processor = require("code_limit")
-- 降低部分英语单词在候选项的位置,可在方案中配置要降低的单词
reduce_english_filter = require("reduce_english_filter")
-- 错音错字提示
Expand Down
3 changes: 0 additions & 3 deletions rime_mint.custom.yaml

This file was deleted.

6 changes: 5 additions & 1 deletion rime_mint.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ switches:
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@*code_length_limit # 使用Lua限制输入内容的最大长度(防止过长而卡顿)
- ascii_composer # ※ 處理西文模式及中西文切換
- recognizer # ※ 與 matcher 搭配,處理符合特定規則的輸入碼,如網址、反查等
- key_binder # ※ 在特定條件下將按鍵綁定到其他按鍵,如重定義逗號、句號爲候選翻頁鍵
Expand Down Expand Up @@ -75,7 +76,7 @@ engine:
- table_translator@melt_eng # 英文输入(作为子翻译器,优先级需要比原生的低)
- table_translator@cn_en # 中英混合词汇
# - echo_translator # ※ 没有候选词,返回字符
- reverse_lookup_translator@wubi98_mint
- reverse_lookup_translator@wubi98_mint 
- reverse_lookup_translator@chaizi
- reverse_lookup_translator@stroke
# - reverse_lookup_translator # 反查模块,多标签情况下去除
Expand All @@ -95,6 +96,9 @@ transcription_cc:
tips: none # 转换提示: all 都显示 | char 仅单字显示 | none 不显示。
excluded_types: [ reverse_lookup ] # 不转换反查(两分拼字)的内容

# 最大输入长度
code_length_limit: 25

# Emoji模块
emoji_suggestion:
opencc_config: emoji.json
Expand Down
4 changes: 4 additions & 0 deletions rime_mint_flypy.schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ switches:
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@*code_length_limit # 使用Lua限制输入内容的最大长度(防止过长而卡顿)
- ascii_composer # ※ 處理西文模式及中西文切換
- recognizer # ※ 與 matcher 搭配,處理符合特定規則的輸入碼,如網址、反查等
- key_binder # ※ 在特定條件下將按鍵綁定到其他按鍵,如重定義逗號、句號爲候選翻頁鍵
Expand Down Expand Up @@ -102,6 +103,9 @@ emoji_suggestion:
tips: all
inherit_comment: false

# 最大输入长度
code_length_limit: 25

# Lua 配置: 降低部分英语单词在候选项的位置。
# 详细介绍 https://dvel.me/posts/make-rime-en-better/#短单词置顶的问题
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
Expand Down
4 changes: 4 additions & 0 deletions terra_pinyin.custom.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ patch:
engine:
processors:
- lua_processor@select_character # 以词定字
- lua_processor@*code_length_limit # 使用Lua限制输入内容的最大长度(防止过长而卡顿)
- ascii_composer
- recognizer
- key_binder
Expand Down Expand Up @@ -82,6 +83,9 @@ patch:
tips: all
inherit_comment: false

# 最大输入长度
code_length_limit: 25

# Lua 配置: 降低部分英语单词在候选项的位置。
# 详细介绍 https://dvel.me/posts/make-rime-en-better/#短单词置顶的问题
# 正常情况: 输入 rug 得到 「1.rug 2.如果 …… 」
Expand Down
3 changes: 0 additions & 3 deletions wubi98_mint.custom.yaml

This file was deleted.

0 comments on commit 90f6734

Please sign in to comment.