Shewer Lu
Shewer Lu
用lua 自載 ```lua function auto_load(env) local config=env.engine.schema.config for _,path in next, {"processors","segments","translators","filters"} do local config_list= config:get_list("engine/" .. path) for i=0,config_list.size do local module = config:get_value_at(i):match("^lua_%a+@(.*)$") module= module:match("^(.+)@.+$") or module _G[module]...
我剛才用 luaL_dostring() ok,前提是 klass 要和 moduel 同名 #151 是要 lua 初始化lua_state 時載入路逕下的所有檔案 這是在 create lua_component時發現 找不到 _G[klass] .custom.yaml patch: engine/translators/lua_translator@date 載入成功 用 luaL_requiref(L, t.klass, nullptr, -1) 會發生 segmentation fault (core...
詞庫早在 deploy 時 就寫入 table.bin prism.bin reverse.bin 所以 要減少詞庫量 是不容易的 建議 還是 手動刪除詞庫 lua_process 可以協助把不要的詞存入檔方便刪詞 用 librime-lua 只是可以動態排除不要的詞組 0 建立 filter_table ( 從檔案 讀取) 1 lua_processor 建立 keyevent 將刪除項寫入 檔案...
我只在 rime_api_console 測試 OK -- 使用方式 當目錄出現時 選擇刪除字 按下 C-Del **如果是 window os** , init.lua **load_word** **append_word** function 內的 filename 要修正 **local filename= path .. "/" .. "rm_word.txt"
另一版本 ,使用 delete_notifier 可以隔離 rm_tab 只在filter env環境內. ```lua function procesor_func(key,env) -- ..... if s.has_menu then if key:repr() =="Control+Delete" then context:delete_current_selection() return Accepted end end -- ....... end local function filter_func(input,env)...
發現 delete_notifier 刪詞(user_dict) connect 先於 filter 所以會有種錯誤 editor/delete_candidate 是屬於 processor : [express_editor|fluid_editor|chor_composer] lua_processor 可能還是要在前面截下才行
https://github.com/rime/librime/blob/a94739f1dc7d6328153b43e6a903e78afdf67fef/src/rime/gear/memory.cc#L122-L136 前面說法 有點出入 抱歉 , 向 delete_notifire 註冊 的是 engine/translators:[table_translator script_translator ] 而 OnDelete 只會在 user_dict 調整時起到 delete_candidate (刪除user_dict candidate) 你覺得正常是因爲 排在前面的OnDelete() 沒有真的 delete_candidate 如果 選中的candidate 是user_dict 就會執行 --> user_dict...
把下面 local function 放入 rime.lua ,可以檢查 log log 可以得到類似 以下訊息 Rime fcitx-rime 5.0.15 (id:f802202b-a976-4d1a-b171-7fba1e1d29f4) Ver: librime 1.7.3 librime-lua 200 lua Lua 5.4 https://github.com/shewer/librime-lua-script/blob/020fb77c4f6f0e2334b6efc835d679ec7eef16b9/lua/tools/rime_api.lua#L81-L110 https://github.com/shewer/librime-lua-script/blob/020fb77c4f6f0e2334b6efc835d679ec7eef16b9/lua/tools/rime_api.lua#L162-L173 ```lua -- 以下加入 rime.lua log.info( "=========="...
上面兩個link 是function Version() Ver_info() code 沒貼上吧
兩個腳本 lua_processor@editor_proc@[editor processor] -- 此proc 會自動載入 filter lua_filter@remove_filter 使用方式 libirme-lua 版本> 197 替換 editor processor < 197 在editor processor 前 插入 ## 安裝1 手動載入( rime.lua 使用require module ) ``` #...