Commit Graph

20 Commits

Author SHA1 Message Date
zonble f39b4fa0bc Moves the Swift StringUtils class to a Swift package. 2022-02-02 22:47:15 +08:00
zonble 5afc5defdd Shows a tooltip when then cursor in a phrase whose length and count of readings do not match.
McBopomofo allows users to input pheases with a different length of the
characters and Bopomofo readings, for example, users can input ∴ with ㄙㄨㄛˇ-ㄧˇ.
When the cursor if between ㄙㄨㄛˇ and ㄧˇ, the users have no clue where
the cursor exactly is. The tooltip is to tell the users the cursor is
now betwen ㄙㄨㄛˇ and ㄧˇ.
2022-02-02 01:04:49 +08:00
zonble 82dbed7815 Fixes a crash on adding user phrases. 2022-02-01 08:41:36 +08:00
zonble 347560e36b Disables adding phrases with shift-arraw keys when the length of the composing buffer and readings do not match. 2022-02-01 08:11:09 +08:00
zonble 74509ce3cb Corrects the selection range while using Shift + Arrow keys to add new phrases. 2022-02-01 06:18:40 +08:00
zonble 2ebc789030 Implements the associated phrases function.
Since we use states manage the input flow in McBopomofo, implementing this function becomes easy. What I did is to create a new state, Associated Phrases state, and let the key handler to emit such a state just after emitting a Committing state.

When the input method controller is under Associated Phrase state, it shows the candidate window with a tooltip, and only accept candidate keys with the shift key. The key handler uses the characters without modifiers in an NSEvent object to find if there is any matching candidate label, so I added a new member "inputTextIgnoringModifiers" to KeyHandlerInput.

I use KeyValueBlobReader to read the associated phrases. I use the cin file from OpenVanilla project but removed the head and tail of the file to pass KeyValueBlobReader's validation.
2022-01-31 13:23:49 +08:00
zonble ae9b524caa Updates the descriptions of the states. 2022-01-30 09:28:26 +08:00
zonble 4c358c1c1d Converts InputMethodController to Swift. 2022-01-30 08:06:22 +08:00
zonble 9612aa6ba0 Code clean-up. 2022-01-28 16:51:25 +08:00
zonble b13da10ec0 Code clean-up. 2022-01-28 16:16:52 +08:00
zonble 0bc9468ba2 Splits Input Method controller into two classes. 2022-01-28 15:02:00 +08:00
zonble dd803b6c31 Removes logs and add copyright information. 2022-01-28 04:40:53 +08:00
zonble 87702f76c5 Cleans-up the interface. 2022-01-28 03:18:10 +08:00
zonble e17d06fd2a Fixes the cursor index when choosing candidates. 2022-01-28 01:58:25 +08:00
zonble fc0c077193 Fixes the bug on handling arrow keys. 2022-01-28 01:35:15 +08:00
zonble 2bbaa4a793 Fixes NSCoding exceptions. 2022-01-28 00:23:31 +08:00
zonble 56c393cefa Prevents using global state as possible. 2022-01-27 23:19:27 +08:00
zonble 1ad9e23918 Refactors the input controller. 2022-01-27 22:54:53 +08:00
zonble 6fe2fc59f3 Moves the way to render attributed string to the states. 2022-01-24 21:47:24 +08:00
zonble 177cba5d56 [WIP] Starts to extract input states from the input controller. 2022-01-24 02:13:18 +08:00