From cd075a5ff4a979f0ab850d0fc747b4db429298e4 Mon Sep 17 00:00:00 2001 From: Yuanle Song Date: Sun, 10 Nov 2019 16:22:22 +0800 Subject: [PATCH] v2.0.7 fix full-width mode support. support space char in full-width mode. --- .gitignore | 3 ++- zero-input.el | 23 ++++++++++++++--------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 56f713c..5f0b98f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.zip *.elc *.tar - +build/ +*.tmp diff --git a/zero-input.el b/zero-input.el index 78bb29a..741c5c2 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.4 +;; 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.4") +(setq zero-input-version "2.0.7") ;; 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. @@ -786,8 +790,9 @@ Otherwise, show Zero." (:eval (zero-input-modeline-string)) zero-input-mode-map ;; local variables and variable init - (zero-input-reset) (make-local-variable 'zero-input-candidates-per-page) + (make-local-variable 'zero-input-full-width-mode) + (zero-input-reset) (zero-input-set-im zero-input-im) ;; hooks (add-hook 'focus-in-hook 'zero-input-focus-in) -- GitLab