Skip to content

Commit

Permalink
Add `pyim-page-format-key-string'
Browse files Browse the repository at this point in the history
  • Loading branch information
tumashu committed Feb 19, 2017
1 parent fd3306c commit d7eab13
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion chinese-pyim-core.el
Original file line number Diff line number Diff line change
Expand Up @@ -2093,6 +2093,18 @@ Return the input string."
whole
(pyim-page-end t)))))

(defun pyim-page-format-key-string (code)
"这个函数用于生成 page 中显示的 code。"
(let* ((scheme-name pyim-default-scheme)
(class (pyim-scheme-get-option scheme-name :class))
(code-maximum-length (pyim-scheme-get-option scheme-name :code-maximum-length)))
(cond
((memq class '(wubi))
(mapconcat #'identity
(pyim-split-string-by-number code code-maximum-length)
" "))
(t (replace-regexp-in-string "-" " " code)))))

(defun pyim-page-refresh (&optional hightlight-current)
"按当前位置,生成候选词条"
(let* ((end (pyim-page-end))
Expand All @@ -2107,7 +2119,7 @@ Return the input string."
(pos (- (min pyim-current-pos (length choices)) start))
(page-info (make-hash-table))
(i 0))
(puthash :key (replace-regexp-in-string "-" " " pyim-entered-code)
(puthash :key (pyim-page-format-key-string pyim-entered-code)
page-info)
(puthash :current-page (pyim-page-current-page) page-info)
(puthash :total-page (pyim-page-total-page) page-info)
Expand Down

0 comments on commit d7eab13

Please sign in to comment.