emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pyim 00d4792 1/2: * pyim-autoselector.el (pyim-autosele


From: ELPA Syncer
Subject: [elpa] externals/pyim 00d4792 1/2: * pyim-autoselector.el (pyim-autoselector-xingma): Fix autoselect wrong code.
Date: Mon, 26 Apr 2021 04:57:15 -0400 (EDT)

branch: externals/pyim
commit 00d4792077f11daa9324312c6de465b8b3d298f5
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    * pyim-autoselector.el (pyim-autoselector-xingma): Fix autoselect wrong 
code.
---
 pyim-autoselector.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/pyim-autoselector.el b/pyim-autoselector.el
index 125f7e3..3c8e7e6 100644
--- a/pyim-autoselector.el
+++ b/pyim-autoselector.el
@@ -65,13 +65,17 @@ entered (nihaom) 的第一个候选词。
 条,自动选择可以减少按空格强制选词的机会。"
   (let* ((scheme-name (pyim-scheme-name))
          (class (pyim-scheme-get-option scheme-name :class))
-         (n (pyim-scheme-get-option scheme-name :code-split-length)))
+         (n (pyim-scheme-get-option scheme-name :code-split-length))
+         (entered (pyim-entered-get 'point-before)))
     (when (eq class 'xingma)
       (cond
-       ((and (= (length (pyim-entered-get 'point-before)) n)
-             (= (length pyim-candidates) 1))
+       ((and (= (length entered) n)
+             (= (length pyim-candidates) 1)
+             ;; 如果没有候选词,pyim 默认将用户输入当做候选词,这时不能自动上屏,
+             ;; 因为这种情况往往是用户输入有误,自动上屏之后,调整输入就变得麻烦了。
+             (not (equal entered (car pyim-candidates))))
         '(:select current))
-       ((> (length (pyim-entered-get 'point-before)) n)
+       ((> (length entered) n)
         '(:select last))
        (t nil)))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]