branch: externals/pyim commit 24705a2dee8c3bc0ac677eda9b57a7ecedd028d3 Author: Feng Shu <tuma...@163.com> Commit: Feng Shu <tuma...@163.com>
Add pyim-outcome-diff --- pyim-liberime.el | 3 +-- pyim-outcome.el | 13 +++++++++++-- pyim-process.el | 3 +-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pyim-liberime.el b/pyim-liberime.el index 48200b9470..79c354ef64 100644 --- a/pyim-liberime.el +++ b/pyim-liberime.el @@ -186,8 +186,7 @@ "从选词框中选择当前词条,然后删除该词条对应拼音。" (pyim-process-select-word-without-save 'do-not-terminate) (let* ((entered (pyim-entered-get 'point-before)) - (word (string-remove-prefix - (or (pyim-outcome-get 1) "") (pyim-outcome-get))) + (word (pyim-outcome-diff)) (code (pyim-liberime--get-code word entered)) (to-be-translated (string-remove-prefix code entered))) diff --git a/pyim-outcome.el b/pyim-outcome.el index 3ed942c793..80395e413a 100644 --- a/pyim-outcome.el +++ b/pyim-outcome.el @@ -126,14 +126,23 @@ pyim 使用函数 `pyim-process-select-handle-char' 来处理特殊功能触发 (pyim-register-local-variables '(pyim-outcome--history)) ;; ** 选词框相关函数 -(defun pyim-outcome-get (&optional n) +(defun pyim-outcome-get () "获取 outcome" - (nth (or n 0) pyim-outcome--history)) + (pyim-outcome--get 0)) + +(defun pyim-outcome--get (n) + "获取 outcome" + (nth n pyim-outcome--history)) (defun pyim-outcome-add (outcome) "添加 OUTCOME." (push outcome pyim-outcome--history)) +(defun pyim-outcome-diff () + "OUTCOME 的变化。" + (string-remove-prefix + (or (pyim-outcome--get 1) "") (pyim-outcome--get 0))) + (defun pyim-outcome-erase () "清除 OUTCOME." (setq pyim-outcome--history nil)) diff --git a/pyim-process.el b/pyim-process.el index a572549f52..fdd4bafc6c 100644 --- a/pyim-process.el +++ b/pyim-process.el @@ -730,8 +730,7 @@ xiaolifeidao 选择。" (let* ((imobj (pyim-process-get-first-imobj)) (length-selected-word-in-this-step - (- (length (pyim-outcome-get)) - (length (pyim-outcome-get 1))))) + (length (pyim-outcome-diff)))) (when (< length-selected-word-in-this-step (length imobj)) (string-join (mapcar (lambda (w)