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

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

[elpa] externals/pyim 7e80507f17 25/26: pyim-process-next-word-position


From: ELPA Syncer
Subject: [elpa] externals/pyim 7e80507f17 25/26: pyim-process-next-word-position
Date: Sun, 26 Jun 2022 10:57:53 -0400 (EDT)

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

    pyim-process-next-word-position
---
 pyim-page.el    | 17 +++++++----------
 pyim-process.el | 14 +++++++-------
 2 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/pyim-page.el b/pyim-page.el
index 1854a8472b..041f773dd9 100644
--- a/pyim-page.el
+++ b/pyim-page.el
@@ -578,15 +578,11 @@ pyim-page 的核心的功能,为此增加代码的复杂度和测试的难度
   (interactive "p")
   (if (pyim-process-without-entered-p)
       (pyim-process-select-last-char)
-    (let* ((new (+ (pyim-process-get-candidate-position)
-                   (* pyim-page-length arg) 1))
-           (maxpos (+ 1 (pyim-process-candidates-length))))
-      (pyim-process-plan-to-select-word
-       (pyim-page--start
-        (if (> new 0)
-            (if (> new maxpos) 1 new)
-          maxpos)))
-      (pyim-process-ui-refresh))))
+    (pyim-process-plan-to-select-word
+     (pyim-page--start
+      (pyim-process-next-word-position
+       (* pyim-page-length arg))))
+    (pyim-process-ui-refresh)))
 
 (defun pyim-page-previous-page (arg)
   (interactive "p")
@@ -596,7 +592,8 @@ pyim-page 的核心的功能,为此增加代码的复杂度和测试的难度
   (interactive "p")
   (if (pyim-process-without-entered-p)
       (pyim-process-select-last-char)
-    (pyim-process-plan-to-select-next-word arg)
+    (pyim-process-plan-to-select-word
+     (pyim-process-next-word-position arg))
     (pyim-process-ui-refresh 'hightlight-current)))
 
 (defun pyim-page-previous-word (arg)
diff --git a/pyim-process.el b/pyim-process.el
index 62ebb30b6a..9f1fc697ca 100644
--- a/pyim-process.el
+++ b/pyim-process.el
@@ -638,13 +638,13 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如:
   (setq pyim-process--candidate-position
         word-position-in-candidates))
 
-(defun pyim-process-plan-to-select-next-word (n)
-  (let ((new (+ (pyim-process-get-candidate-position) n))
-        (len (pyim-process-candidates-length))
-        (pos (if (>= len new)
-                 (if (> new 0) new len)
-               1)))
-    (pyim-process-plan-to-select-word pos)))
+(defun pyim-process-next-word-position (n)
+  (let* ((new (+ (pyim-process-get-candidate-position) n))
+         (len (pyim-process-candidates-length))
+         (pos (if (>= len new)
+                  (if (> new 0) new len)
+                1)))
+    pos))
 
 ;; ** 选词相关
 (cl-defgeneric pyim-process-select-word (scheme))



reply via email to

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