1 ;; zh-util.mim -- Provide utilities for Chinese input methods.
3 ;; National Institute of Advanced Industrial Science and Technology (AIST)
4 ;; Registration Number H15PRO112
6 ;; This file is part of the m17n library.
8 ;; The m17n library is free software; you can redistribute it and/or
9 ;; modify it under the terms of the GNU Lesser General Public License
10 ;; as published by the Free Software Foundation; either version 2.1 of
11 ;; the License, or (at your option) any later version.
13 ;; The m17n library is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 ;; Lesser General Public License for more details.
18 ;; You should have received a copy of the GNU Lesser General Public
19 ;; License along with the m17n library; if not, write to the Free
20 ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 ;; Boston, MA 02110-1301, USA.
23 (input-method t nil zh-util)
25 (description "Provide utilities for Chinese input methods.
26 This is acutually not a standalone input method, but is expected
27 to be included in the other Chinese input method (e.g. zh-py).
31 ;; Typing 1, 2, ..., 0 selects the 0th, 1st, ..., 9th candidate.
55 ;; When an input spot is moved, commit the current predit by shifting
60 ;; When an input focus is out or in, keep the current preedit.
61 ((input-focus-out) (set KK @@) (sub KK 1) (undo KK))
62 ((input-focus-in) (set KK @@) (sub KK 1) (undo KK)))
72 ;; When Backspace is typed, cancel the last input.
74 (focus-move (shift init))
76 ;; When anything else is typed, produce the current candidate (if
77 ;; any), and re-handle the last input in "init" state.
78 (nil (hide) (shift init)))
81 (t (set K @@) (sub K 1))
82 ;; When a number is typed, select the corresponding canidate,
83 ;; produce it, and shift to "init" state.
84 (focus-move (shift init))
86 (choose (hide) (shift init))
89 ;; When key to force committing, commit the current preedit.
90 (commit-preedit (shift init))
91 ;; When anything else is typed, produce the current candidate,
92 ;; and re-handle the last input in "init" state.
93 (nil (hide) (shift init))))