From 30af996e81b11c5453addb46e122b7c38e74f673 Mon Sep 17 00:00:00 2001 From: Yuanle Song <sylecn@gmail.com> Date: Sun, 10 Nov 2019 16:16:44 +0800 Subject: [PATCH] v2.0.6 support space in full-width mode --- operational | 10 +++++++++- zero-input-framework-test.el | 3 ++- zero-input-framework.el | 18 +++++++++++------- zero-input.el | 20 ++++++++++++-------- 4 files changed, 34 insertions(+), 17 deletions(-) diff --git a/operational b/operational index 584f763..26455c7 100644 --- a/operational +++ b/operational @@ -85,12 +85,20 @@ cd ~/lisp/elisp/zero/ ** 2019-11-10 关于屏幕闪烁,我临时解决方案是中文输入时,当光标到达半屏的时候,自动跳到首行,这样也方便一些,不过还是期待后续版本能解决这个问题 * current :entry: ** -** 2019-11-10 space doesn't work in full-width mode. ** 2019-11-03 add completion support for zero-input-set-im complete registered im symbols. ** 2019-10-23 checkdoc and package-lint can't ignore some non-issues. I can't run them in git pre-commit hook. * done :entry: +** 2019-11-10 space doesn't work in full-width mode. +全角和半角 - 维基百科,自由的百科全书 +https://zh.wikipedia.org/wiki/%E5%85%A8%E5%BD%A2%E5%92%8C%E5%8D%8A%E5%BD%A2 + +ascii full-width unicode codepoint. +0x20 " " U+3000 + +- add a failing unit test. + ** 2019-11-07 full width mode no longer works. why? C-c , . enabled full-width mode. but modeline is not changed. diff --git a/zero-input-framework-test.el b/zero-input-framework-test.el index 64ae851..21ff95f 100644 --- a/zero-input-framework-test.el +++ b/zero-input-framework-test.el @@ -29,7 +29,8 @@ (should (eq (zero-input-cycle-list '(a b c) 'd) nil))) (ert-deftest zero-input-convert-ch-to-full-width () - (should (= (zero-input-convert-ch-to-full-width ?\!) ?\!))) + (should (= (zero-input-convert-ch-to-full-width ?\!) ?\!)) + (should (= (zero-input-convert-ch-to-full-width ?\s) ?\u3000))) (ert-deftest zero-input-convert-str-to-full-width () (should (string-equal "!" (zero-input-convert-str-to-full-width "!"))) diff --git a/zero-input-framework.el b/zero-input-framework.el index 8df1fdd..52e09da 100644 --- a/zero-input-framework.el +++ b/zero-input-framework.el @@ -132,7 +132,7 @@ If item is not in lst, return nil." ;; zero-input-el version (defvar zero-input-version nil "Zero package version.") -(setq zero-input-version "2.0.5") +(setq zero-input-version "2.0.6") ;; FSM state (defconst zero-input--state-im-off 'IM-OFF) @@ -352,13 +352,17 @@ COMPLETE-FUNC the function to call when build candidates completes." ;; update cache to make SPC and digit key selection possible. (funcall complete-func candidates))) -(defvar zero-input-full-width-char-map - ;; ascii 33 to 126 map to - ;; unicode FF01 to FF5E - (cl-loop - for i from 33 to 126 - collect (cons (make-char 'ascii i) (make-char 'unicode 0 255 (- i 32)))) +(defvar zero-input-full-width-char-map nil "An alist that map half-width char to full-width char.") +(setq zero-input-full-width-char-map + (cons + ;; ascii 32 -> unicode 3000 + (cons ?\s ?\u3000) + ;; ascii [33, 126] -> unicode [FF01, FF5E] + (cl-loop + for i from 33 to 126 + collect (cons (make-char 'ascii i) + (make-char 'unicode 0 255 (- i 32)))))) (defun zero-input-convert-ch-to-full-width (ch) "Convert half-width char CH to full-width. diff --git a/zero-input.el b/zero-input.el index c99e8a9..74677fb 100644 --- a/zero-input.el +++ b/zero-input.el @@ -12,7 +12,7 @@ ;; See the License for the specific language governing permissions and ;; limitations under the License. -;; Version: 2.0.5 +;; Version: 2.0.6 ;; URL: https://gitlab.emacsos.com/sylecn/zero-el ;; Package-Requires: ((emacs "24.3") (s "1.2.0")) @@ -243,7 +243,7 @@ If item is not in lst, return nil." ;; zero-input-el version (defvar zero-input-version nil "Zero package version.") -(setq zero-input-version "2.0.5") +(setq zero-input-version "2.0.6") ;; FSM state (defconst zero-input--state-im-off 'IM-OFF) @@ -463,13 +463,17 @@ COMPLETE-FUNC the function to call when build candidates completes." ;; update cache to make SPC and digit key selection possible. (funcall complete-func candidates))) -(defvar zero-input-full-width-char-map - ;; ascii 33 to 126 map to - ;; unicode FF01 to FF5E - (cl-loop - for i from 33 to 126 - collect (cons (make-char 'ascii i) (make-char 'unicode 0 255 (- i 32)))) +(defvar zero-input-full-width-char-map nil "An alist that map half-width char to full-width char.") +(setq zero-input-full-width-char-map + (cons + ;; ascii 32 -> unicode 3000 + (cons ?\s ?\u3000) + ;; ascii [33, 126] -> unicode [FF01, FF5E] + (cl-loop + for i from 33 to 126 + collect (cons (make-char 'ascii i) + (make-char 'unicode 0 255 (- i 32)))))) (defun zero-input-convert-ch-to-full-width (ch) "Convert half-width char CH to full-width. -- GitLab