Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 97541a8

Browse files
authored
Update rime_api.lua
1 parent db389ee commit 97541a8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lua/tools/rime_api.lua

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,12 @@ rime_api.get_shared_data_dir= function()
7878
return '/usr/shared/rime-data'
7979
end
8080
--]]
81-
local function Version()
81+
local function Version(env)
82+
if type(env) == "table" and env.engine then
83+
if env.engine.context.composition:toSegmentation().get_segments then
84+
return 215
85+
end
86+
end
8287
local ver
8388
if Opencc and Opencc('s2t.json').convert_word then
8489
return 200
@@ -159,15 +164,15 @@ end
159164

160165
----- rime_api tools
161166

162-
local function Ver_info()
167+
local function Ver_info(env)
163168
local msg1 = rime_api.get_user_id and string.format(" %s %s %s (id:%s) ",
164169
rime_api.get_distribution_name(),
165170
rime_api.get_distribution_code_name(),
166171
rime_api.get_distribution_version(),
167172
rime_api.get_user_id()) or ""
168173

169174
local msg2 = string.format(" Ver: librime %s librime-lua %s lua %s",
170-
rime_api.get_rime_version() , Version() ,_VERSION )
175+
rime_api.get_rime_version() , Version(env) ,_VERSION )
171176

172177
return msg1 .. msg2
173178
end

0 commit comments

Comments
 (0)