[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 34b5c39ae1 4/5: Add pyim-process-ui-position
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 34b5c39ae1 4/5: Add pyim-process-ui-position |
Date: |
Mon, 27 Jun 2022 23:57:48 -0400 (EDT) |
branch: externals/pyim
commit 34b5c39ae1e22754a96dc2e261ec00c648ff65f9
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
Add pyim-process-ui-position
---
pyim-page.el | 2 +-
pyim-preview.el | 6 ++----
pyim-process.el | 7 ++++---
3 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/pyim-page.el b/pyim-page.el
index 435f25f9cc..bf4040baeb 100644
--- a/pyim-page.el
+++ b/pyim-page.el
@@ -188,7 +188,7 @@ page 的概念,比如,上面的 “nihao” 的 *待选词列表* 就可以
(null unread-post-input-method-events))
(pyim-page-show
(pyim-page-info-format style page-info)
- (funcall pyim-process-ui-position-function)
+ (pyim-process-ui-position)
tooltip))))
(add-hook 'pyim-process-ui-refresh-hook #'pyim-page--refresh)
diff --git a/pyim-preview.el b/pyim-preview.el
index 808165066f..b1e3272897 100644
--- a/pyim-preview.el
+++ b/pyim-preview.el
@@ -126,12 +126,10 @@ pyim 会使用 Emacs overlay 机制在 *待输入buffer* 光标处高亮显示
(add-hook 'pyim-process-ui-hide-hook #'pyim-preview--delete-string)
-(defun pyim-preview--start-point ()
- "Preview 字符串的开始位置。"
+(cl-defmethod pyim-process-ui-position ()
+ "使用 Preview 字符串的开始位置作为 UI 的放置位置。"
(overlay-start pyim-preview--overlay))
-(setq pyim-process-ui-position-function #'pyim-preview--start-point)
-
;; * Footer
(provide 'pyim-preview)
diff --git a/pyim-process.el b/pyim-process.el
index 1e20c95fb4..6ebbf65789 100644
--- a/pyim-process.el
+++ b/pyim-process.el
@@ -101,9 +101,6 @@ entered (nihaom) 的第一个候选词。
(defvar pyim-process-ui-hide-hook nil
"Hook used to run ui hide functions.")
-(defvar pyim-process-ui-position-function #'point
- "The value is a function returned a position where ui place.")
-
(defvar pyim-process-start-daemon-hook nil
"Pyim start daemon hook.")
@@ -315,6 +312,10 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如:
"初始化 pyim 相关 UI."
(run-hooks 'pyim-process-ui-init-hook))
+(cl-defgeneric pyim-process-ui-position ()
+ "返回选词框等 UI 放置的位置。"
+ (point))
+
(defun pyim-process-init-dcaches (&optional force)
"PYIM 流程,词库相关的初始化工作。"
(pyim-recreate-local-variables)