[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 9180e45 2/5: * pyim-dhashcache.el (pyim-dcache-cod
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 9180e45 2/5: * pyim-dhashcache.el (pyim-dcache-code-split): Improve code. |
Date: |
Tue, 4 May 2021 07:57:15 -0400 (EDT) |
branch: externals/pyim
commit 9180e45f5f71e184bbad14f9b51f8256bfe7c25a
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
* pyim-dhashcache.el (pyim-dcache-code-split): Improve code.
---
pyim-dhashcache.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index fc99cd5..9f1fd41 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -61,10 +61,14 @@
(defun pyim-dcache-code-split (code)
"将 CODE 分成 code-prefix 和 rest code."
(cond
+ ;; 处理 nil
+ ((not code) nil)
;; 兼容性代码:旧版本的 pyim 使用一个标点符号作为 code-prefix
((pyim-string-match-p "^[[:punct:]]" code)
(list (substring code 0 1) (substring code 1)))
- ;; 拼音输入法不使用 code-prefix.
+ ;; 拼音输入法不使用 code-prefix, 并且包含 -
+ ((pyim-string-match-p "-" code)
+ (list "" code))
((not (pyim-string-match-p "[[:punct:]]" code))
(list "" code))
;; 新 code-prefix 使用类似 "wubi/" 的格式。