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

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

[elpa] externals/pyim bedc0c6a4e 1/3: Fix: 开启 pyim-isearch-mode 后,搜索时输入


From: ELPA Syncer
Subject: [elpa] externals/pyim bedc0c6a4e 1/3: Fix: 开启 pyim-isearch-mode 后,搜索时输入反斜杠 (\) 会导致卡死 #453
Date: Tue, 6 Sep 2022 04:58:03 -0400 (EDT)

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

    Fix: 开启 pyim-isearch-mode 后,搜索时输入反斜杠 (\) 会导致卡死 #453
---
 pyim-cregexp.el     | 3 ++-
 tests/pyim-tests.el | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/pyim-cregexp.el b/pyim-cregexp.el
index e8604dc317..bd40e38216 100644
--- a/pyim-cregexp.el
+++ b/pyim-cregexp.el
@@ -106,7 +106,8 @@ regexp, 所以搜索单字的时候一般可以搜到生僻字,但搜索句子
   (let ((char-level-num
          (pyim-cregexp--char-level-num char-level-num))
         rx-string)
-    (while (not (pyim-cregexp--valid-p rx-string))
+    (while (and (not (pyim-cregexp--valid-p rx-string))
+                (> char-level-num 0))
       (setq rx-string
             (pyim-cregexp--create-beautiful-cregexp-from-string
              string scheme char-level-num chinese-only))
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index db3667e608..8d7aa0979c 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -922,6 +922,11 @@
       (should (equal (buffer-substring (point-min) (point)) "哈哈")))))
 
 ;; ** pyim-cregexp 相关单元测试
+(ert-deftest pyim-tests-pyim-cregexp--valid-p ()
+  (should-not (pyim-cregexp--valid-p "\\"))
+  (should (pyim-cregexp--valid-p "\\\\"))
+  (should (pyim-cregexp--valid-p "a")))
+
 (ert-deftest pyim-tests-pyim-cregexp--find-scheme ()
   (should-not (pyim-cregexp--find-scheme nil))
   (should (equal (pyim-scheme-name (pyim-cregexp--find-scheme 'wubi)) 'wubi))



reply via email to

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