forked from iDvel/rime-ice
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
2 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
-- 中文或者英文后,再输入英文单词自动添加空格 | ||
-- 英文后,再输入英文单词(必须为候选项)自动添加空格 | ||
local F = {} | ||
|
||
function F.func( input, env ) | ||
local latest_text = env.engine.context.commit_history:latest_text() | ||
for cand in input:iter() do | ||
if cand.text:match( '^[%a\']+[%a\']*$' ) and latest_text and #latest_text > 0 and | ||
not latest_text:find( '[%p%s。,;?:—!《》‘’“”、¥…()【】「」『』]$' ) then | ||
latest_text:find( '^ ?[%a\']+[%a\']*$' ) then | ||
cand = cand:to_shadow_candidate( 'en_spacer', cand.text:gsub( '(%a+\'?%a*)', ' %1' ), cand.comment ) | ||
end | ||
yield( cand ) | ||
end | ||
end | ||
|
||
return F | ||
|