Closed RuijieYu closed 1 year ago
Actually, this might already be the case, but only for the currently selected candidate. I see this between the input key and the list of candidates. Am I understanding it correctly?
If so, maybe this issue can be closed, thanks.
yes, this feature is controled by the below code
(cl-defgeneric pyim-page-preview-create (scheme &optional separator)
"这个函数用于创建在 page 中显示的预览字符串。
这个预览是在 page 中显示,而 `pyim-preview--refresh' 对应的预览
是在 buffer 光标处显示,两者要做区别。")
(cl-defmethod pyim-page-preview-create ((_scheme pyim-scheme-quanpin) &optional separator)
(let* ((separator (or separator " "))
(translated (string-join (mapcar (lambda (w)
(concat (nth 0 w) (nth 1 w)))
(pyim-process-get-first-imobj))
separator)))
(concat
;; | 显示光标位置的字符
(pyim-process-with-entered-buffer
(if (equal 1 (point))
(concat "|" translated)
(concat (replace-regexp-in-string (concat separator "'") "'" translated)
" |" (buffer-substring-no-properties (point) (point-max)))))
;; 使用辅助输入法时,在 page 中提示默认输入法的 code, 这个功能对形码用户挺
;; 有用。
(pyim-page--code-hint-of-default-scheme))))
(defun pyim-page--code-hint-of-default-scheme ()
"获取当前词条在默认输入法下的 code 提示."
(when (pyim-scheme-assistant-enable-p)
(let* ((word (nth (pyim-process-word-position)
(pyim-process-get-candidates)))
(codes (sort (pyim-cstring-to-codes
word (pyim-scheme-get pyim-default-scheme))
(lambda (a b)
(< (length a) (length b)))))
(hint (string-join codes " ")))
(if (> (length hint) 0)
(format " [%s]" hint)
" "))))
Thanks. Closing, since the requested feature is already in place.
For example, when I have this setup:
And when I enable assistant scheme via TAB, I want to be able to see how to type a candidate in wubi when I use pinyin to type it.
This feature, if implemented, should be locked behind an opt-in
defcustom
, because it takes space to display this information, and the user might need to adjust the number of displayed candidates accordingly, especially when the candidates are displayed in minibuffer.This proposed feature is in the same vein as the assistant scheme itself, for people who are still unfamiliar with the default scheme and need additional help using the assistant scheme.