Compare commits

...

14 Commits

Author SHA1 Message Date
Jules Aguillon
e60304b30d prefs: Add 'delete_word' and 'forward_delete_word' to extra keys
Some checks failed
Make Apk CI / Build-Apk (push) Has been cancelled
Check translations / check-translations (push) Has been cancelled
Check layouts / check_layout.output (push) Has been cancelled
Check layouts / Generated files (push) Has been cancelled
The gesture combination is mentioned. Preferred position are added.
2025-03-01 16:50:54 +01:00
Jules Aguillon
a6f9c72eb3 Add 'delete_word' and 'forward_delete_word' keys
These keys are the equivalent of ctrl+backspace and ctrl+delete,
respectively.

They can be reached with Gesture+backspace and Gesture+delete
respectively.
2025-03-01 16:50:28 +01:00
dzaima
2b978dd2e0 APL and BQN layouts (#899)
Some checks failed
Make Apk CI / Build-Apk (push) Has been cancelled
Check translations / check-translations (push) Has been cancelled
Check layouts / check_layout.output (push) Has been cancelled
Check layouts / Generated files (push) Has been cancelled
* Add compact BQN layout

* Add compact APL layout
2025-02-28 00:47:49 +01:00
Jules Aguillon
55cb5f5315 Make key symbol smaller when 2 characters long or more
This was the case for string keys but not for macros or keys with custom
symbols.
2025-02-28 00:36:14 +01:00
Jules Aguillon
b7d1508d7b Refactor: Remove StringWithSymbol
It's replaced with a macro containing one key.
2025-02-28 00:17:28 +01:00
Jules Aguillon
77b0c30728 cyrl_lynyertz_sr: Use the newer key syntax for ctrl mappings 2025-02-27 23:56:26 +01:00
Jules Aguillon
466e0b8218 KeyValue: Don't wrap keys into a macro when possible
Many kind of KeyValues don't need to be wrapped into a Macro to show a
specific symbol. This is especially useful as Macro keys are not
affected by modifiers.
The parser is changed to have a fast-path when a key value is not a
macro.
2025-02-27 23:53:42 +01:00
Jules Aguillon
75fdc2bfa9 Fix miscalculation of the bottom margin
'_marginBottom' might be uninitialized when used.
2025-02-27 23:20:49 +01:00
Jules Aguillon
bee59aceaa Show a message in voice input chooser when empty
This avoids creating an empty dialog that appears as a mysterious white
rectangle.
2025-02-27 23:12:08 +01:00
Spike
92d50dd73f Clerical edits to "Possible values.md" (#907)
Some checks are pending
Check layouts / check_layout.output (push) Waiting to run
Check layouts / Generated files (push) Waiting to run
Check translations / check-translations (push) Waiting to run
Make Apk CI / Build-Apk (push) Waiting to run
* Massage Intro

Start with definition, then use cases, then valid syntax.

Use "legend" rather than "symbol" for the visible legend on the keyboard

Rephrase to avoid "exhaustive". Other simplifications.

* Edit section "Modifiers"

Separate into two tables, each preceded by relevant introduction

* Shuffle sections

Retitle "Special keys"; as used in the Intro, this term refers to all the keywords in this file.

Put two contrasting sections together, add "In contrast," and reword.
2025-02-27 22:12:59 +01:00
Jules Aguillon
ba05b2770e Fix crash due to empty strings in keys 2025-02-27 22:00:32 +01:00
Sergiy Stupar
44d1343b83 Update Ukrainian translation (#909) 2025-02-27 21:32:44 +01:00
Jules Aguillon
ca25cc55f6 Apply compose sequences to String keys
Some checks failed
Make Apk CI / Build-Apk (push) Has been cancelled
Check translations / check-translations (push) Has been cancelled
Check layouts / check_layout.output (push) Has been cancelled
Check layouts / Generated files (push) Has been cancelled
This is mostly useful for characters that do not fit on a single 16-bit
char.
Shift sequences for 𝕨𝕩𝕗𝕘𝕤 are added for illustration.
2025-02-23 18:00:44 +01:00
Jules Aguillon
68be82a4f9 Macro keys (#878)
Some checks are pending
Check layouts / check_layout.output (push) Waiting to run
Check layouts / Generated files (push) Waiting to run
Check translations / check-translations (push) Waiting to run
Make Apk CI / Build-Apk (push) Waiting to run
Add "macro" keys that behave as if a sequence of keys is typed.

Macro can be added to custom layouts or through the "Add keys to the
keyboard option". The syntax is:

    symbol:key1,key2,..

The symbol cannot contain a : character. 'key1', 'key2', etc.. are:

  - 'String with \' escaping'
    The key will generate the specified string.
  - keyevent:123
    The key will send a keyevent.
  - The name of any special key
2025-02-23 12:12:29 +01:00
43 changed files with 943 additions and 357 deletions

Binary file not shown.

View File

@@ -1,9 +1,36 @@
# Key values
This is an exhaustive list of special values accepted for the `key0` through `key8` or `nw` through `se` attributes on a key.
A key value defines what a key on the keyboard does when pressed or swiped.
Any string that does not exactly match these will be printed verbatim.
A key can output multiple characters, but cannot combine multiple built-in key values.
Key values appear in the following places:
- In custom layouts, they are the value of: the `c` attribute, the compass-point attributes `nw` ... `se`, and the old-style `key0` ... `key8` attributes.
- Internally, they are used in the definition of the "Add keys to the keyboard" setting.
Key values can be any of the following:
- The name of a special key. A complete list of valid special keys follows.
- An arbitrary sequence of characters not containing `:`.
This results in a key that writes the specified characters.
- The syntax `legend:key_def`.
`legend` is the visible legend on the keyboard. It cannot contain `:`.
`key_def` can be:
+ The name of a special key, as listed below.
+ `'string'` An arbitrary string that can contain `:`. `'` can be added to the string as `` \' ``.
+ `keyevent:keycode` An Android keycode. They are listed as `KEYCODE_...` in [KeyEvent](https://developer.android.com/reference/android/view/KeyEvent#summary).
Examples:
+ `⏯:keyevent:85` A play/pause key (which has no effect in most apps).
+ `my@:'my.email@domain.com'` A key that sends an arbitrary string
- A macro, `symbol:key_def1,key_def2,...`.
This results in a key that behaves as if the sequence of `key_def` had been pressed in order.
Examples:
+ `CA:ctrl,a,ctrl,c` A key with legend CA that sends the sequence `ctrl+a`, `ctrl+c`.
+ `Cd:ctrl,backspace` A key with legend Cd that sends the shortcut `ctrl+backspace`.
## Escape codes
Value | Escape code for
@@ -25,19 +52,24 @@ Value | Escape code for
`"` | `"`
## Modifiers
System modifiers are sent to the app, which is free to do whatever they want in response.
The other modifiers only exist within the keyboard.
System modifiers are sent to the app, which can take app-specific action.
Value | Meaning
:---------- | :------
`shift` | System modifier.
`ctrl` | System modifier.
`alt` | System modifier.
`meta` | System modifier. Equivalent to the Windows key.
`fn` | Activates Fn mode, which assigns letters and symbols to special characters. e.g. `fn` `!` = `¡`
`compose` | Compose key. Enables composing characters using Linux-like shortcuts; e.g. `Compose` `A` `single quote` types `Á` (A with acute accent).
`capslock` | Actives and locks Shift
## Special keys
The other modifiers take effect only within the keyboard.
Value | Meaning
:---------- | :------
`fn` | Activates Fn mode, which assigns letters and symbols to special characters. Example: `fn` `!` = `¡`
`compose` | Compose key. Enables composing characters using Linux-like shortcuts. Example: `Compose` `A` `'` types `Á` (A with acute accent).
`capslock` | Activates and locks Shift.
## App function keys
These keys are sent to apps, which are free to ignore them. The keyboard does not perform editing in response to these keys.
`esc`, `enter`,
@@ -53,6 +85,17 @@ These keys are sent to apps, which are free to ignore them. The keyboard does no
`selectAll`, `pasteAsPlainText`,
`undo`, `redo`
## Keyboard editing actions
In contrast, these keys perform editing on the text without sending anything to the app.
Value | Meaning
:-------------------- | :------
`cursor_left` | Moves the cursor to the left with the slider gesture.
`cursor_right` | Moves the cursor to the right with the slider gesture.
`cursor_up` | Moves the cursor up with the slider gesture. Warning: this might make the cursor leave the text box.
`cursor_down` | Moves the cursor down with the slider gesture. Warning: this might make the cursor leave the text box.
`delete_word` | Delete the word to the left of the cursor.
`forward_delete_word` | Delete the word to the right of the cursor.
## Whitespace
Value | Meaning
:------ | :------
@@ -62,15 +105,6 @@ Value | Meaning
`zwj` | Zero-width joiner.
`zwnj` | Zero-width non-joiner.
## Keyboard editing actions
These keys perform editing on the text without sending keys that the app can interpret differently or ignore.
Value | Meaning
:----------------- | :------
`cursor_left` | Moves the cursor to the left with the slider gesture.
`cursor_right` | Moves the cursor to the right with the slider gesture.
`cursor_up` | Moves the cursor up with the slider gesture. Warning: this might make the cursor leave the text box.
`cursor_down` | Moves the cursor down with the slider gesture. Warning: this might make the cursor leave the text box.
## Other modifiers and diacritics
Value | Meaning
:------------------- | :------
@@ -152,50 +186,3 @@ These keys are known to do nothing.
These keys are normally hidden unless the Fn modifier is activated.
`f11_placeholder` | `f12_placeholder`
## Complex keys
More complex keys are of this form:
```
:<kind> <attributes>:<payload>
```
Where `<kind>` is one of the kinds documented below and `<attributes>` is a
space separated list of attributes. `<payload>` depends on the `<kind>`.
Attributes are:
- `symbol='Sym'` specifies the symbol to be shown on the keyboard.
- `flags='<flags>'` changes the behavior of the key.
`<flags>` is a coma separated list of:
+ `dim`: Make the symbol dimmer.
+ `small`: Make the symbol smaller.
### Kind `str`
Defines a key that outputs an arbitrary string. `<payload>` is a string wrapped
in single-quotes (`'`), escaping of other single quotes is allowed with `\'`.
For example:
- `:str:'Arbitrary string with a \' inside'`
- `:str symbol='Symbol':'Output string'`
### Kind `char`
Defines a key that outputs a single character. `<payload>` is the character to
output, unquoted.
This kind of key can be used to define a character key with a different symbol
on it. `char` keys can be modified by `ctrl` and other modifiers, unlike `str`
keys.
For example:
- `:char symbol='љ':q`, which is used to implement `ctrl` shortcuts in cyrillic
layouts.
### Kind `keyevent`
Defines a key that sends an Android [key event](https://developer.android.com/reference/android/view/KeyEvent).
`<payload>` is the key event number.
For example:
- `:keyevent symbol='⏯' flags='small':85`

View File

@@ -127,8 +127,12 @@ Tato aplikace neobsahuje žádné reklamy, nevyužívá připojení k síti a je
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Nedávno kopírovaný text</string>
<string name="clipboard_pin_heading">Připnout</string>
<string name="clipboard_remove_confirm">Odebrat ze schránky?</string>
<string name="clipboard_remove_confirmed">Ano</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ Diese App enthält keine Werbung, benötigt keinen Netzwerkzugriff und ist quell
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Zuletzt kopierter Text</string>
<string name="clipboard_pin_heading">Angeheftet</string>
<string name="clipboard_remove_confirm">Aus der Zwischenablage entfernen?</string>
<string name="clipboard_remove_confirmed">Ja</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ La misma no contiene ningún anuncio/publicidad, no realiza peticiones de red y
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Textos recién copiados</string>
<string name="clipboard_pin_heading">Pegado</string>
<string name="clipboard_remove_confirm">¿Sacar este portapapeles?</string>
<string name="clipboard_remove_confirmed"></string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ Cette application ne contient pas de publicité, n'accède pas au réseau et est
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Texte récemment copié</string>
<string name="clipboard_pin_heading">Épinglé</string>
<string name="clipboard_remove_confirm">Supprimer ce presse-papiers ?</string>
<string name="clipboard_remove_confirmed">Oui</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ This application contains no ads, doesn't make any network requests and is Open
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -128,8 +128,12 @@ PCキーボードでの半角入力を再現しています。日本語入力、
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">最近コピーしたテキスト</string>
<string name="clipboard_pin_heading">お気に入り</string>
<string name="clipboard_remove_confirm">クリップボードから削除しますか?</string>
<string name="clipboard_remove_confirmed">はい</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">최근에 복사한 텍스트</string>
<string name="clipboard_pin_heading">고정</string>
<string name="clipboard_remove_confirm">이 클립보드를 제거하시겠습니까?</string>
<string name="clipboard_remove_confirmed"></string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -129,8 +129,12 @@ Tagad lieliski piemērota izmantošanai ikdienā.
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Nesen starpliktuvē ievietots teksts</string>
<string name="clipboard_pin_heading">Piesprausts</string>
<string name="clipboard_remove_confirm">Noņemt šo starpliktuves vienumu?</string>
<string name="clipboard_remove_confirmed"></string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ Aplikacja nie zawiera reklam, nie żąda dostępu do internetu, a jej kod źród
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Ostatnio skopiowane elementy</string>
<string name="clipboard_pin_heading">Przypięte</string>
<string name="clipboard_remove_confirm">Usunąć ten element ze schowka?</string>
<string name="clipboard_remove_confirmed">Tak</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ Este aplicativo não contém anúncios, não faz nenhuma solicitação de rede e
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Textos recém copiados</string>
<string name="clipboard_pin_heading">Fixados</string>
<string name="clipboard_remove_confirm">Remover esta cópia?</string>
<string name="clipboard_remove_confirmed">Sim</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ Această aplicație nu conține publicitate, nu folosește rețeaua deloc și e
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@
<string name="key_descr_zwnj">Разделитель нулевой ширины</string>
<string name="key_descr_nbsp">Неразрывный пробел</string>
<string name="key_descr_nnbsp">Узкий неразрывный пробел</string>
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Недавно скопированный текст</string>
<string name="clipboard_pin_heading">Закреплено</string>
<string name="clipboard_remove_confirm">Удалить этот буфер обмена?</string>
<string name="clipboard_remove_confirmed">Да</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ Bu uygulama açık kaynaklıdır. Reklam içermez ve internete bağlanmaz."</str
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Son kopyalanan metin</string>
<string name="clipboard_pin_heading">Sabitlendi</string>
<string name="clipboard_remove_confirm">Bu sabitlemeyi sil</string>
<string name="clipboard_remove_confirmed">Evet</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -71,7 +71,7 @@
<string name="pref_theme_e_monet">Моне (Системна)</string>
<string name="pref_theme_e_monetlight">Моне (Світла)</string>
<string name="pref_theme_e_monetdark">Моне (Темна)</string>
<!-- <string name="pref_theme_e_rosepine">Rosé Pine</string> -->
<string name="pref_theme_e_rosepine">Рожева сосна</string>
<string name="pref_swipe_dist_e_very_short">Дуже коротка</string>
<string name="pref_swipe_dist_e_short">Коротка</string>
<string name="pref_swipe_dist_e_default">Звичайна</string>
@@ -122,13 +122,17 @@
<string name="key_descr_end">End</string>
<string name="key_descr_clipboard">Менеджер буфера обміну</string>
<string name="key_descr_combining">Комбінування діакритики</string>
<!-- <string name="key_descr_dead_key">Dead key</string> -->
<!-- <string name="key_descr_zwj">Zero width joiner</string> -->
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<string name="key_descr_dead_key">Мертва клавіша</string>
<string name="key_descr_zwj">З\'єднувач нульової ширини</string>
<string name="key_descr_zwnj">Разділювач нульової ширини</string>
<string name="key_descr_nbsp">Нерозривний пробіл</string>
<string name="key_descr_nnbsp">Вузький нерозривний пробіл</string>
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<string name="clipboard_history_heading">Нещодавно скопійований текст</string>
<string name="clipboard_pin_heading">Закріплено</string>
<string name="clipboard_remove_confirm">Видалити цей буфер обміну?</string>
<string name="clipboard_remove_confirmed">Так</string>
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@ Bây giờ đã hoàn hảo cho việc sử dụng hàng ngày.
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -127,8 +127,12 @@
<!-- <string name="key_descr_zwnj">Zero width non-joiner</string> -->
<!-- <string name="key_descr_nbsp">Non-breaking space</string> -->
<!-- <string name="key_descr_nnbsp">Narrow non-breaking space</string> -->
<!-- <string name="key_descr_delete_word">Delete a word</string> -->
<!-- <string name="key_descr_forward_delete_word">Delete a word on the right</string> -->
<!-- <string name="key_descr_gesture">Gesture</string> -->
<!-- <string name="clipboard_history_heading">Recently copied text</string> -->
<!-- <string name="clipboard_pin_heading">Pinned</string> -->
<!-- <string name="clipboard_remove_confirm">Remove this clipboard?</string> -->
<!-- <string name="clipboard_remove_confirmed">Yes</string> -->
<!-- <string name="toast_no_voice_input">No voice typing app installed</string> -->
</resources>

View File

@@ -41,7 +41,9 @@
<item>latn_bepo_fr</item>
<item>latn_bone</item>
<item>latn_neo2</item>
<item>latn_qwerty_apl</item>
<item>latn_qwerty_az</item>
<item>latn_qwerty_bqn</item>
<item>latn_qwerty_br</item>
<item>latn_qwerty_cy</item>
<item>latn_qwerty_cz</item>
@@ -122,7 +124,9 @@
<item>BEPO (Français)</item>
<item>Bone</item>
<item>Neo 2</item>
<item>QWERTY (APL)</item>
<item>QWERTY (Azərbaycanca)</item>
<item>QWERTY (BQN)</item>
<item>QWERTY (Brasileiro)</item>
<item>QWERTY (Welsh)</item>
<item>QWERTY (Czech)</item>
@@ -203,7 +207,9 @@
<item>@xml/latn_bepo_fr</item>
<item>@xml/latn_bone</item>
<item>@xml/latn_neo2</item>
<item>@xml/latn_qwerty_apl</item>
<item>@xml/latn_qwerty_az</item>
<item>@xml/latn_qwerty_bqn</item>
<item>@xml/latn_qwerty_br</item>
<item>@xml/latn_qwerty_cy</item>
<item>@xml/latn_qwerty_cz</item>

View File

@@ -127,8 +127,12 @@ This application contains no ads, doesn't make any network requests and is Open
<string name="key_descr_zwnj">Zero width non-joiner</string>
<string name="key_descr_nbsp">Non-breaking space</string>
<string name="key_descr_nnbsp">Narrow non-breaking space</string>
<string name="key_descr_delete_word">Delete a word</string>
<string name="key_descr_forward_delete_word">Delete a word on the right</string>
<string name="key_descr_gesture">Gesture</string>
<string name="clipboard_history_heading">Recently copied text</string>
<string name="clipboard_pin_heading">Pinned</string>
<string name="clipboard_remove_confirm">Remove this clipboard?</string>
<string name="clipboard_remove_confirmed">Yes</string>
<string name="toast_no_voice_input">No voice typing app installed</string>
</resources>

View File

@@ -88,6 +88,16 @@
"⊃": "⊇",
"±": "∓",
// APL
"": "⍶",
"⍵": "⍹",
"⋄": "⌺",
"⍝": "⍧",
"∆": "⍙",
"∇": "⍢",
"": "⍡",
"⎕": "⍞",
// hebrew niqqud
"ק": "qamats", // kamatz
"ר": "hataf_qamats", // reduced kamatz

View File

@@ -125,5 +125,14 @@
"ॢ": "ॣ",
"॒": "॑",
"ॅ": "ॲ",
"ॉ": "ऑ"
"ॉ": "ऑ",
// Mathematical symbols
"\uD835": {
"\uDD68": "𝕎", // 𝕨𝕎
"\uDD69": "𝕏", // 𝕩𝕏
"\uDD57": "𝔽", // 𝕗𝔽
"\uDD58": "𝔾", // 𝕘𝔾
"\uDD64": "𝕊" // 𝕤𝕊
}
}

View File

@@ -88,6 +88,24 @@ public final class Autocapitalisation
callback_now(true);
}
/** Pause auto capitalisation until [unpause()] is called. */
public boolean pause()
{
boolean was_enabled = _enabled;
stop();
_enabled = false;
return was_enabled;
}
/** Continue auto capitalisation after [pause()] was called. Argument is the
output of [pause()]. */
public void unpause(boolean was_enabled)
{
_enabled = was_enabled;
_should_update_caps_mode = true;
callback_now(true);
}
public static interface Callback
{
public void update_shift_state(boolean should_enable, boolean should_disable);

View File

@@ -4,31 +4,22 @@ import java.util.Arrays;
public final class ComposeKey
{
/** Apply the pending compose sequence to [kv]. */
/** Apply the pending compose sequence to [kv]. Returns [null] if no sequence
matched. */
public static KeyValue apply(int state, KeyValue kv)
{
switch (kv.getKind())
{
case Char:
KeyValue res = apply(state, kv.getChar());
// Grey-out characters not part of any sequence.
if (res == null)
return kv.withFlags(kv.getFlags() | KeyValue.FLAG_GREYED);
return res;
/* Tapping compose again exits the pending sequence. */
case Compose_pending:
return KeyValue.getKeyByName("compose_cancel");
/* These keys are not greyed. */
case Event:
case Modifier:
return kv;
/* Other keys cannot be part of sequences. */
default:
return kv.withFlags(kv.getFlags() | KeyValue.FLAG_GREYED);
return apply(state, kv.getChar());
case String:
return apply(state, kv.getString());
}
return null;
}
/** Apply the pending compose sequence to char [c]. */
/** Apply the pending compose sequence to char [c]. Returns [null] if no
sequence matched. */
public static KeyValue apply(int prev, char c)
{
char[] states = ComposeKeyData.states;
@@ -51,6 +42,25 @@ public final class ComposeKey
return KeyValue.makeCharKey((char)next_header);
}
/** Apply each char of a string to a sequence. Returns [null] if no sequence
matched. */
public static KeyValue apply(int prev, String s)
{
final int len = s.length();
int i = 0;
if (len == 0) return null;
while (true)
{
KeyValue k = apply(prev, s.charAt(i));
i++;
if (k == null) return null;
if (i >= len) return k;
if (k.getKind() != KeyValue.Kind.Compose_pending)
return null; // Found a final state before the end of [s].
prev = k.getPendingCompose();
}
}
/** The state machine is comprised of two arrays.
The [states] array represents the different states and the associated

View File

@@ -111,16 +111,16 @@ public final class ComposeKeyData
"|\u00a8\u2218\u2395\u0000/\u2adc\u0000 !\"%'()*,-.0123456789:<=>?[]^_abcehlopruyz{|}\u00a3\u00a7\u00b1\u00d7\u0398\u03a0\u03a3\u03b2\u03b3\u03b5\u03b8\u03ba\u03c0\u03c1\u03c3\u03c5\u03c6\u0430\u0435" +
"\u0437\u0438\u0439\u043b\u043c\u043d\u043e\u0441\u0443\u0447\u0448\u044a\u044b\u044c\u044d\u044f\u0456\u0458\u045f\u0461\u0481\u0487\u049b\u04b7\u04c8\u0513\u05d1\u05d3\u05d5\u05d6\u05d7\u05dd\u05e1\u05e3\u05e4\u05e6\u05e7\u05e8\u05e9\u0625\u0626\u0627\u0628\u0629\u062b\u062d\u0631\u0632\u0633\u0635\u0637\u0639\u063a\u063d\u0641\u0642\u0643\u0644\u0646\u0647\u064a\u064f\u0650\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668" +
"\u0669\u06a1\u06a9\u06c6\u06c9\u06cc\u06ce\u06f0\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u0901\u0902\u0905\u0906\u0907\u0908\u0909\u090a\u090b\u090c\u090f\u0910\u0913\u0914\u0915\u0916\u0917\u0918\u091a\u091b\u091c\u091d\u091f\u0921\u0922\u0923\u0925\u0926\u0928\u092a\u092b\u092c\u092f\u0930\u0933\u0935\u0936\u0937\u093c\u093d\u093e\u093f\u0940\u0941\u0943\u0947\u0948\u094b\u094c\u0953\u0956\u0962\u0964\u0970\u0b92" +
"\u0b9a\u0baf\u0bb3\u0bb5\u2020\u20ac\u20b9\u2190\u2191\u2192\u2193\u2194\u2195\u2196\u2197\u2198\u2199\u2203\u2227\u2228\u2229\u222a\u222b\u2282\u2283\u22b7\ua649\ua651\ua67d\uFFFF\u006e\u0062\u0073\u0070\uFFFF\u0066\u0031\u0030\uFFFF\u0066\u0031\uFFFF\u0066\u0032\uFFFF\u0066\u0033\uFFFF\u0066\u0034\uFFFF\u0066\u0035\uFFFF\u0066\u0036\uFFFF\u0066\u0037\uFFFF\u0066\u0038\uFFFF\u0066\u0039\uFFFF\u007a\u0077\u006e\u006a\u20b1\u20b4" +
"\u20bf\uFFFF\u0072\u0065\u006d\u006f\u0076\u0065\u0064\u2213\u2219\u03f4\u220f\u2211\u03d0\u0263\u03f5\u03d1\u03f0\u03d6\u03f1\u03c2\u03d2\u03d5\u0465\uFFFF\ua641\u0456\u0458\u046b\u0467\u047b\u0455\uFFFF\ua64b\u044c\uFFFF\ua651\u044a\u0454\u0438\uFFFF\ua66f\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0073\u0065\u0067\u006f\u006c\uFFFF\u0064\u0061\u0067\u0065\u0073\u0068\uFFFF\u0068\u006f\u006c\u0061\u006d\uFFFF\u0071\u0075\u0062" +
"\u0075\u0074\u0073\uFFFF\u0068\u0069\u0072\u0069\u0071\uFFFF\u0072\u0061\u0066\u0065\uFFFF\u0073\u0065\u0067\u006f\u006c\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0070\u0061\u0074\u0061\u0068\uFFFF\u0070\u0061\u0074\u0061\u0068\uFFFF\u0074\u0073\u0065\u0072\u0065\uFFFF\u0071\u0061\u006d\u0061\u0074\u0073\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0071\u0061\u006d\u0061\u0074\u0073\uFFFF\u0073\u0068\u0065\u0076\u0061\u066e\u067e" +
"\u06c1\u0698\u0640\u0636\u0638\u0621\u06a4\u063a\u06a9\u06ba\u06be\u06cc\u0643\u064a\u0900\u0955\u0972\u0911\u0973\u0974\u0976\u0977\u0960\u0961\u090d\u090e\u0912\u0975\u097b\u097c\uFFFF\u0936\u094d\u091a\u0979\u0978\u097e\uFFFF\u0924\u094d\u0930\uFFFF\u0926\u094d\u0930\uFFFF\u092a\u094d\u0930\u097f\u097a\uFFFF\u0936\u094d\u0930\uFFFF\u0915\u094d\u0937\u094e\u097d\u0949\u093a\u093b\u0904\u0944\u0945\u0946\u094a\u094f\u0954\u0957" +
"\u0963\u0965\u0971\uFFFF\u0bd0\uFFFF\u0bf2\uFFFF\u0bf0\uFFFF\u0bf1\uFFFF\u0bf3\u21d4\u21d5\u21d6\u21d7\u21d8\u21d9\u22c0\u22c1\u22c2\u22c3\u222e\u22b6\u044b\u0483\u00000123456789\u09e6\u09e7\u09e8\u09e9\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u00000123456789\u0966\u0967\u0968\u0969\u096a\u096b\u096c\u096d\u096e\u096f\u000001" +
"23456789\u0ae6\u0ae7\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef\u00000123456789\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u00000123456789\u0ce6\u0ce7\u0ce8\u0ce9\u0cea\u0ceb\u0cec\u0ced\u0cee\u0cef\u00000123456789\u06f0" +
"\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u00000123456789\u0be6\u0be7\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef\u0000\u00df\u0131\u01f0\u0237\u02b0\u02b2\u02b3\u02b7\u02e1\u0905\u0907\u0909\u090b\u090c\u090f\u0913\u0915\u0917\u091a\u091c\u091f\u0921\u0924\u0926\u0928\u092c\u092e\u0932\u0938\u0939\u093f\u0941\u0943\u0945\u0947\u0949\u094b\u0952\u0962\u0a85\u0a87" +
"\u0a89\u0a8f\u0a93\u0a95\u0a97\u0a9a\u0a9c\u0a9f\u0aa1\u0aa4\u0aa6\u0aa8\u0aaa\u0aac\u0aae\u0ab2\u0ab8\u0ab9\u0abf\u0ac1\u0ac7\u0acb\u0bf9\u1d43\u1d47\u1d48\u1d49\u1d4d\u1d4f\u1d50\u1d52\u1d56\u1d57\u1d58\u1d5b\u1d60\u1d9c\u1da0\u1dbe\u1e97\u1e98\u1e99\u2071\u207f\u20b9\u2190\u2191\u2192\u2193\u2196\u2197\u2198\u2199\u2208\u220b\u2282\u2283\u2286\u2287\u2500\u2502\u250c\u2510\u2514\u2518\u251c\u2524\u252c\u2534\u253c\uFFFF\u004a" +
"\u030c\uFFFF\u004a\u0307\u1d34\u1d36\u1d3f\u1d42\u1d38\u0906\u0908\u090a\u0910\u0914\u0916\u0918\u091b\u091d\u0920\u0922\u0925\u0927\u0923\u092d\u0902\u0933\u0936\u0903\u0940\u0942\u0948\u094c\u0951\u0a86\u0a88\u0a8a\u0a90\u0a94\u0a96\u0a98\u0a9b\u0a9d\u0aa0\u0aa2\u0aa5\u0aa7\u0aa3\u0aab\u0aad\u0a82\u0ab3\u0ab6\u0a83\u0ac0\u0ac2\u0ac8\u0acc\u1d2c\u1d2e\u1d30\u1d31\u1d33\u1d37\u1d39\u1d3c\u1d3e\u1d40\u1d41\u2c7d\u1db2\uFFFF\ua7f2" +
"\uFFFF\ua7f3\u1d23\uFFFF\u0054\u0308\uFFFF\u0057\u030a\uFFFF\u0059\u030a\u1d35\u1d3a\u2550\u2551\u2554\u2557\u255a\u255d\u2560\u2563\u2566\u2569\u256c").toCharArray();
"\u0b9a\u0baf\u0bb3\u0bb5\u2020\u20ac\u20b9\u2190\u2191\u2192\u2193\u2194\u2195\u2196\u2197\u2198\u2199\u2203\u2206\u2207\u2227\u2228\u2229\u222a\u222b\u2282\u2283\u22a4\u22b7\u22c4\u235d\u2375\u237a\u2395\ua649\ua651\ua67d\uFFFF\u006e\u0062\u0073\u0070\uFFFF\u0066\u0031\u0030\uFFFF\u0066\u0031\uFFFF\u0066\u0032\uFFFF\u0066\u0033\uFFFF\u0066\u0034\uFFFF\u0066\u0035\uFFFF\u0066\u0036\uFFFF\u0066\u0037\uFFFF\u0066\u0038\uFFFF\u0066" +
"\u0039\uFFFF\u007a\u0077\u006e\u006a\u20b1\u20b4\u20bf\uFFFF\u0072\u0065\u006d\u006f\u0076\u0065\u0064\u2213\u2219\u03f4\u220f\u2211\u03d0\u0263\u03f5\u03d1\u03f0\u03d6\u03f1\u03c2\u03d2\u03d5\u0465\uFFFF\ua641\u0456\u0458\u046b\u0467\u047b\u0455\uFFFF\ua64b\u044c\uFFFF\ua651\u044a\u0454\u0438\uFFFF\ua66f\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0073\u0065\u0067\u006f\u006c\uFFFF\u0064\u0061\u0067\u0065\u0073\u0068\uFFFF\u0068" +
"\u006f\u006c\u0061\u006d\uFFFF\u0071\u0075\u0062\u0075\u0074\u0073\uFFFF\u0068\u0069\u0072\u0069\u0071\uFFFF\u0072\u0061\u0066\u0065\uFFFF\u0073\u0065\u0067\u006f\u006c\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0070\u0061\u0074\u0061\u0068\uFFFF\u0070\u0061\u0074\u0061\u0068\uFFFF\u0074\u0073\u0065\u0072\u0065\uFFFF\u0071\u0061\u006d\u0061\u0074\u0073\uFFFF\u0068\u0061\u0074\u0061\u0066\u005f\u0071\u0061\u006d\u0061\u0074\u0073" +
"\uFFFF\u0073\u0068\u0065\u0076\u0061\u066e\u067e\u06c1\u0698\u0640\u0636\u0638\u0621\u06a4\u063a\u06a9\u06ba\u06be\u06cc\u0643\u064a\u0900\u0955\u0972\u0911\u0973\u0974\u0976\u0977\u0960\u0961\u090d\u090e\u0912\u0975\u097b\u097c\uFFFF\u0936\u094d\u091a\u0979\u0978\u097e\uFFFF\u0924\u094d\u0930\uFFFF\u0926\u094d\u0930\uFFFF\u092a\u094d\u0930\u097f\u097a\uFFFF\u0936\u094d\u0930\uFFFF\u0915\u094d\u0937\u094e\u097d\u0949\u093a\u093b" +
"\u0904\u0944\u0945\u0946\u094a\u094f\u0954\u0957\u0963\u0965\u0971\uFFFF\u0bd0\uFFFF\u0bf2\uFFFF\u0bf0\uFFFF\u0bf1\uFFFF\u0bf3\u21d4\u21d5\u21d6\u21d7\u21d8\u21d9\u22c0\u22c1\u22c2\u22c3\u222e\u22b6\u044b\u0483\u00000123456789\u09e6\u09e7\u09e8\u09e9\u09ea\u09eb\u09ec\u09ed\u09ee\u09ef\u00000123456789\u0966\u0967\u0968\u0969\u096a" +
"\u096b\u096c\u096d\u096e\u096f\u00000123456789\u0ae6\u0ae7\u0ae8\u0ae9\u0aea\u0aeb\u0aec\u0aed\u0aee\u0aef\u00000123456789\u0660\u0661\u0662\u0663\u0664\u0665\u0666\u0667\u0668\u0669\u00000123456789\u0ce6\u0ce7\u0ce8\u0ce9\u0cea\u0ceb\u0cec\u0ced\u0cee\u0cef\u0000012" +
"3456789\u06f0\u06f1\u06f2\u06f3\u06f4\u06f5\u06f6\u06f7\u06f8\u06f9\u00000123456789\u0be6\u0be7\u0be8\u0be9\u0bea\u0beb\u0bec\u0bed\u0bee\u0bef\u0000\u00df\u0131\u01f0\u0237\u02b0\u02b2\u02b3\u02b7\u02e1\u0905\u0907\u0909\u090b\u090c\u090f\u0913\u0915\u0917\u091a\u091c\u091f\u0921\u0924\u0926\u0928\u092c\u092e\u0932\u0938\u0939\u093f\u0941\u0943" +
"\u0945\u0947\u0949\u094b\u0952\u0962\u0a85\u0a87\u0a89\u0a8f\u0a93\u0a95\u0a97\u0a9a\u0a9c\u0a9f\u0aa1\u0aa4\u0aa6\u0aa8\u0aaa\u0aac\u0aae\u0ab2\u0ab8\u0ab9\u0abf\u0ac1\u0ac7\u0acb\u0bf9\u1d43\u1d47\u1d48\u1d49\u1d4d\u1d4f\u1d50\u1d52\u1d56\u1d57\u1d58\u1d5b\u1d60\u1d9c\u1da0\u1dbe\u1e97\u1e98\u1e99\u2071\u207f\u20b9\u2190\u2191\u2192\u2193\u2196\u2197\u2198\u2199\u2208\u220b\u2282\u2283\u2286\u2287\u2500\u2502\u250c\u2510\u2514" +
"\u2518\u251c\u2524\u252c\u2534\u253c\ud835\uFFFF\u004a\u030c\uFFFF\u004a\u0307\u1d34\u1d36\u1d3f\u1d42\u1d38\u0906\u0908\u090a\u0910\u0914\u0916\u0918\u091b\u091d\u0920\u0922\u0925\u0927\u0923\u092d\u0902\u0933\u0936\u0903\u0940\u0942\u0948\u094c\u0951\u0a86\u0a88\u0a8a\u0a90\u0a94\u0a96\u0a98\u0a9b\u0a9d\u0aa0\u0aa2\u0aa5\u0aa7\u0aa3\u0aab\u0aad\u0a82\u0ab3\u0ab6\u0a83\u0ac0\u0ac2\u0ac8\u0acc\u1d2c\u1d2e\u1d30\u1d31\u1d33\u1d37" +
"\u1d39\u1d3c\u1d3e\u1d40\u1d41\u2c7d\u1db2\uFFFF\ua7f2\uFFFF\ua7f3\u1d23\uFFFF\u0054\u0308\uFFFF\u0057\u030a\uFFFF\u0059\u030a\u1d35\u1d3a\u2550\u2551\u2554\u2557\u255a\u255d\u2560\u2563\u2566\u2569\u256c\u0000\udd57\udd58\udd64\udd68\udd69\uFFFF\ud835\udd3d\uFFFF\ud835\udd3e\uFFFF\ud835\udd4a\uFFFF\ud835\udd4e\uFFFF\ud835\udd4f").toCharArray();
public static final char[] edges =
("\u0001\u0036\u0037\u0038\u0039\u003a\u003b\u003c\u003f\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047\u0048\u0049\u004a\u004b\u004c\u004d\u004e\u004f\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0059\u005a\u005b\\\u005d\u005e\u005f\u0060\u0061\u0062\u0063\u0064\u0067\u0068\u006b\u006e\u006f\u0072\u0075\u0078\u007b\u007e\u0081\u0001\u0001\u0001\u0001\u0001\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001" +
@@ -226,19 +226,19 @@ public final class ComposeKeyData
"\u1c22\u0001\u0001\u0003\u1387\u1c26\u0001\u0003\u0cab\u1c2a\u0001\u0003\u1388\u1c2e\u0001\u0003\u0cac\u1c32\u0001\u0002\u1c35\u0001\u0004\u111c\u1389\u1c3a\u0001\u0005\u138a\u1407\u04f5\u1c40\u0001\u0002\u1c43\u0001\u0002\u111d\u0002\u1c48\u0001\u0008\u111e\u04e4\u1c51\u1c52\u1c53\u1c54\u1c55\u0001\u0001\u0001\u0001\u0001\u0002\u1c58\u0001\u0002\u1c5b\u0001\u0004\u1408\u0de1\u1c60\u0001\u0004\u1409\u0de1\u1c65\u0001\u0002\u1c51" +
"\u0002\u138b\u0002\u1c6c\u0001\u0002\u1c6f\u0001\u0002\u1c72\u0001\u0002\u1c75\u0001\u0003\u111f\u1c79\u0001\u0002\u111f\u0002\u1c7e\u0001\u0002\u1c81\u0001\u0002\u1c84\u0001\u0002\u1c87\u0001\u0002\u1c8a\u0001\u0002\u1c8d\u0001\u0002\u1c90\u0001\u0002\u1c93\u0001\u0002\u1c96\u0001\u0002\u1c99\u0001\u0004\u1c9e\u1120\u138c\u0001\u0003\u1ca2\u1121\u0001\u0002\u1ca5\u0001\u0002\u1ca8\u0001\u0002\u1cab\u0001\u0002\u1cae\u0001\u0002" +
"\u1cb1\u0001\u0005\u1423\u1473\u1c52\u1cb7\u0001\u0004\u1122\u1c53\u1cb7\u0002\u1cbe\u0001\u0002\u1cc1\u0001\u0002\u1cc4\u0001\u0002\u1cc7\u0001\u0002\u1cca\u0001\u0002\u1ccd\u0001\u0002\u1cd0\u0001\u0003\u1123\u1cd4\u0001\u0002\u1124\u0002\u1125\u0002\u1126\u0016\u083b\u0d65\u0da7\u0deb\u0e1e\u0e3d\u0e7c\u0fe8\u1550\u1c26\u1c2a\u1c2e\u1c32\u1c3a\u1c40\u1c54\u1c60\u1c65\u1c79\u1cd4\u1cf1\u0001\n\u0c23\u0cad\u0d23\u0fe9\u1127" +
"\u138d\u1424\u1c55\u1cf1\u0002\u1cfe\u0001\u00ee\u1ded\u066c\u06cc\u0706\u07ce\u06cd\u06ce\u0351\u0cfd\u0c95\u0cfe\u1df2\u1df6\u1df9\u1dfc\u1dff\u1e02\u1e05\u1e08\u1e0b\u1e0e\u1e11\u0ddf\u1401\u0e36\u0e66\u07d3\u07d4\u0c59\u0c94\u1222\u1e16\u0d58\u0e0f\u1e17\u0ca6\u12fa\u0e13\u0e14\u0d5a\u0e18\u1e18\u0d00\u0688\u0d02\u1e19\u0f3a\u1e21\u1e22\u1e23\u1e24\u1e25\u1e26\u1e27\u1e28\u1e29\u1e2a\u1e2b\u1e2c\u1e2d\u1e2e\u1e2f\u162d\u1e30" +
"\u1e31\u1e33\u1e34\u0d1f\u1e35\u1e36\u1e37\u1e38\u1e39\u16ef\u16ea\u1e3b\u1e3c\u1e3e\u1e3f\u179e\u1e40\u0fb7\u0d22\u1640\u0d1e\u1e41\u1665\u166f\u16b6\u0d1f\u1e43\u1e4f\u1e56\u1e5c\u1e63\u1e69\u1e6e\u1e74\u1e80\u1e86\u1e8c\u1e93\u1ea0\u1884\u189a\u1967\u1ea6\u191b\u1ea7\u1ea8\u1870\u1ea9\u1eaa\u1eab\u1eac\u1ead\u18b3\u1995\u1eae\u1eaf\u1eb0\u18d0\u1eb1\u1eb2\u1eb3\u192b\u192c\u1df2\u1df6\u1df9\u1dfc\u1dff\u1e02\u1e05\u1e08\u1e0b" +
"\u1e0e\u1938\u1eb4\u197c\u1995\u1eb5\u1955\u1df2\u1df6\u1df9\u1dfc\u1dff\u1e02\u1e05\u1e08\u1e0b\u1e0e\u1eb6\u1eb7\u1eb8\u1eb9\u1eba\u1ebb\u1ebc\u1ebd\u1ebe\u1ebf\u1ec0\u1ec1\u1ec2\u1ec3\u19d6\u19d7\u19d8\u1ec4\u1ec5\u1ec6\u19d9\u1eca\u1ecb\u19da\u19db\u1ecc\u1ecd\u1ed1\u19dc\u1ed5\u19dd\u1ed9\u19de\u19df\u19e0\u1eda\u1edb\u1edf\u1ee3\u1ee4\u1ee5\u1ee6\u1ee7\u1ee8\u1ee9\u1eea\u1eeb\u1eec\u1eed\u1eee\u1eef\u1ef0\u1ef1\u1ef2\u1ef3" +
"\u1ef5\u1ef7\u1ef9\u1efb\u1385\u1e19\u0f48\u0e0d\u0e19\u0e0e\u0e1c\u1efd\u1efe\u1eff\u1f00\u1f01\u1f02\u1c35\u1f03\u1f04\u1f05\u1f06\u1f07\u1120\u1121\u1f08\u1672\u1f09\u1f0a\u0005\u0000\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0001\u0001" +
"\u0001\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0001\u0002\u0000\u0001\u0001\u0001\u0002\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000" +
"\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\r\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0001\u0001" +
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001" +
"\u0001\u0001\u0001\u0002\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f16\u1f17\u1f18\u1f19\u1f1a\u1f1b\u1f1c\u1f1d\u1f1e\u1f1f\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f2b\u1f2c\u1f2d\u1f2e\u1f2f\u1f30\u1f31\u1f32\u1f33\u1f34\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f40\u1f41" +
"\u1f42\u1f43\u1f44\u1f45\u1f46\u1f47\u1f48\u1f49\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f55\u1f56\u1f57\u1f58\u1f59\u1f5a\u1f5b\u1f5c\u1f5d\u1f5e\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f6a\u1f6b\u1f6c\u1f6d\u1f6e\u1f6f\u1f70\u1f71\u1f72\u1f73\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f7f\u1f80\u1f81\u1f82\u1f83\u1f84\u1f85\u1f86\u1f87\u1f88\u0001" +
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f94\u1f95\u1f96\u1f97\u1f98\u1f99\u1f9a\u1f9b\u1f9c\u1f9d\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0070\u0f55\u0d0b\u200e\u2011\u2014\u2015\u2016\u2017\u2018\u2019\u201a\u201b\u1ebe\u1ebf\u201c\u201d\u201e\u201f\u2020\u2021\u2022\u2023\u2024\u2025\u2026\u2027\u2028\u2029\u202a\u202b\u202c\u202d\u1ee9\u1eb8\u202e\u1eb9\u202f\u2030\u1ef0\u2031\u2032" +
"\u2033\u2034\u2035\u2036\u2037\u2038\u2039\u203a\u203b\u203c\u203d\u203e\u203f\u2040\u2041\u2042\u2043\u2044\u2045\u2046\u2047\u2048\u0f48\u2049\u204a\u204b\u204c\u204d\u204e\u204f\u2050\u2051\u2052\u2053\u2054\u2055\u2056\u2058\u205a\u205b\u205e\u2061\u2064\u2065\u0f48\u0e0d\u0e19\u0e0e\u0e1c\u1eff\u1f00\u1f01\u1f02\u1c43\u1c48\u1c9e\u1ca2\u1ca5\u1ca8\u2066\u2067\u2068\u2069\u206a\u206b\u206c\u206d\u206e\u206f\u2070\u0003\u0000" +
"\u0000\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000" +
"\u0002\u0000\u0001\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001").toCharArray();
"\u138d\u1424\u1c55\u1cf1\u0002\u1cfe\u0001\u00f6\u1df5\u066c\u06cc\u0706\u07ce\u06cd\u06ce\u0351\u0cfd\u0c95\u0cfe\u1dfa\u1dfe\u1e01\u1e04\u1e07\u1e0a\u1e0d\u1e10\u1e13\u1e16\u1e19\u0ddf\u1401\u0e36\u0e66\u07d3\u07d4\u0c59\u0c94\u1222\u1e1e\u0d58\u0e0f\u1e1f\u0ca6\u12fa\u0e13\u0e14\u0d5a\u0e18\u1e20\u0d00\u0688\u0d02\u1e21\u0f3a\u1e29\u1e2a\u1e2b\u1e2c\u1e2d\u1e2e\u1e2f\u1e30\u1e31\u1e32\u1e33\u1e34\u1e35\u1e36\u1e37\u162d\u1e38" +
"\u1e39\u1e3b\u1e3c\u0d1f\u1e3d\u1e3e\u1e3f\u1e40\u1e41\u16ef\u16ea\u1e43\u1e44\u1e46\u1e47\u179e\u1e48\u0fb7\u0d22\u1640\u0d1e\u1e49\u1665\u166f\u16b6\u0d1f\u1e4b\u1e57\u1e5e\u1e64\u1e6b\u1e71\u1e76\u1e7c\u1e88\u1e8e\u1e94\u1e9b\u1ea8\u1884\u189a\u1967\u1eae\u191b\u1eaf\u1eb0\u1870\u1eb1\u1eb2\u1eb3\u1eb4\u1eb5\u18b3\u1995\u1eb6\u1eb7\u1eb8\u18d0\u1eb9\u1eba\u1ebb\u192b\u192c\u1dfa\u1dfe\u1e01\u1e04\u1e07\u1e0a\u1e0d\u1e10\u1e13" +
"\u1e16\u1938\u1ebc\u197c\u1995\u1ebd\u1955\u1dfa\u1dfe\u1e01\u1e04\u1e07\u1e0a\u1e0d\u1e10\u1e13\u1e16\u1ebe\u1ebf\u1ec0\u1ec1\u1ec2\u1ec3\u1ec4\u1ec5\u1ec6\u1ec7\u1ec8\u1ec9\u1eca\u1ecb\u19d6\u19d7\u19d8\u1ecc\u1ecd\u1ece\u19d9\u1ed2\u1ed3\u19da\u19db\u1ed4\u1ed5\u1ed9\u19dc\u1edd\u19dd\u1ee1\u19de\u19df\u19e0\u1ee2\u1ee3\u1ee7\u1eeb\u1eec\u1eed\u1eee\u1eef\u1ef0\u1ef1\u1ef2\u1ef3\u1ef4\u1ef5\u1ef6\u1ef7\u1ef8\u1ef9\u1efa\u1efb" +
"\u1efd\u1eff\u1f01\u1f03\u1385\u1e21\u0f48\u0e0d\u0e19\u0e0e\u0e1c\u1f05\u1f06\u1f07\u1f08\u1f09\u1f0a\u1c35\u111c\u04f5\u1f0b\u1f0c\u1f0d\u1f0e\u1f0f\u1120\u1121\u1423\u1f10\u1cd4\u138c\u1125\u1126\u083b\u1672\u1f11\u1f12\u0005\u0000\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000" +
"\u0000\u0005\u0000\u0000\u0000\u0000\u0001\u0001\u0001\u0008\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0001\u0002\u0000\u0001\u0001\u0001\u0002\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000" +
"\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0005\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u000c\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0006\u0000\u0000\u0000\u0000\u0000\u0007\u0000\u0000\u0000\u0000\u0000\u0000\r\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000" +
"\u0006\u0000\u0000\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0001\u0004\u0000\u0000\u0000\u0004\u0000\u0000\u0000\u0001\u0001\u0001\u0001\u0001" +
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0002\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f1e\u1f1f\u1f20\u1f21\u1f22\u1f23\u1f24\u1f25\u1f26\u1f27\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f33\u1f34\u1f35\u1f36\u1f37\u1f38\u1f39\u1f3a\u1f3b\u1f3c\u0001\u0001\u0001\u0001\u0001" +
"\u0001\u0001\u0001\u0001\u0001\u000b\u1f48\u1f49\u1f4a\u1f4b\u1f4c\u1f4d\u1f4e\u1f4f\u1f50\u1f51\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f5d\u1f5e\u1f5f\u1f60\u1f61\u1f62\u1f63\u1f64\u1f65\u1f66\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f72\u1f73\u1f74\u1f75\u1f76\u1f77\u1f78\u1f79\u1f7a\u1f7b\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f87\u1f88\u1f89" +
"\u1f8a\u1f8b\u1f8c\u1f8d\u1f8e\u1f8f\u1f90\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u000b\u1f9c\u1f9d\u1f9e\u1f9f\u1fa0\u1fa1\u1fa2\u1fa3\u1fa4\u1fa5\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0071\u0f55\u0d0b\u2017\u201a\u201d\u201e\u201f\u2020\u2021\u2022\u2023\u2024\u1ec6\u1ec7\u2025\u2026\u2027\u2028\u2029\u202a\u202b\u202c\u202d\u202e\u202f\u2030\u2031\u2032\u2033\u2034\u2035\u2036\u1ef1" +
"\u1ec0\u2037\u1ec1\u2038\u2039\u1ef8\u203a\u203b\u203c\u203d\u203e\u203f\u2040\u2041\u2042\u2043\u2044\u2045\u2046\u2047\u2048\u2049\u204a\u204b\u204c\u204d\u204e\u204f\u2050\u2051\u0f48\u2052\u2053\u2054\u2055\u2056\u2057\u2058\u2059\u205a\u205b\u205c\u205d\u205e\u205f\u2061\u2063\u2064\u2067\u206a\u206d\u206e\u0f48\u0e0d\u0e19\u0e0e\u0e1c\u1f07\u1f08\u1f09\u1f0a\u1c43\u1c48\u1c9e\u1ca2\u1ca5\u1ca8\u206f\u2070\u2071\u2072\u2073" +
"\u2074\u2075\u2076\u2077\u2078\u2079\u207a\u0003\u0000\u0000\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001" +
"\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0002\u0000\u0002\u0000\u0001\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0001\u0006\u2080\u2083\u2086\u2089\u208c\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000\u0003\u0000\u0000").toCharArray();
public static final int accent_aigu = 1;
public static final int accent_arrows = 130;
@@ -265,12 +265,12 @@ public final class ComposeKeyData
public static final int accent_trema = 1172;
public static final int compose = 1270;
public static final int fn = 7423;
public static final int numpad_bengali = 7947;
public static final int numpad_devanagari = 7968;
public static final int numpad_gujarati = 7989;
public static final int numpad_hindu = 8010;
public static final int numpad_kannada = 8031;
public static final int numpad_persian = 8052;
public static final int numpad_tamil = 8073;
public static final int shift = 8094;
public static final int numpad_bengali = 7955;
public static final int numpad_devanagari = 7976;
public static final int numpad_gujarati = 7997;
public static final int numpad_hindu = 8018;
public static final int numpad_kannada = 8039;
public static final int numpad_persian = 8060;
public static final int numpad_tamil = 8081;
public static final int shift = 8102;
}

View File

@@ -97,11 +97,9 @@ public final class KeyEventHandler
case Keyevent: send_key_down_up(key.getKeyevent()); break;
case Modifier: break;
case Editing: handle_editing_key(key.getEditing()); break;
case Compose_pending:
_recv.set_compose_pending(true);
break;
case Compose_pending: _recv.set_compose_pending(true); break;
case Slider: handle_slider(key.getSlider(), key.getSliderRepeat()); break;
case StringWithSymbol: send_text(key.getStringWithSymbol()); break;
case Macro: evaluate_macro(key.getMacro()); break;
}
update_meta_state(old_mods);
}
@@ -148,11 +146,11 @@ public final class KeyEventHandler
if (down)
{
_meta_state = _meta_state | meta_flags;
send_keyevent(KeyEvent.ACTION_DOWN, eventCode);
send_keyevent(KeyEvent.ACTION_DOWN, eventCode, _meta_state);
}
else
{
send_keyevent(KeyEvent.ACTION_UP, eventCode);
send_keyevent(KeyEvent.ACTION_UP, eventCode, _meta_state);
_meta_state = _meta_state & ~meta_flags;
}
}
@@ -183,25 +181,28 @@ public final class KeyEventHandler
}
}
/*
* Don't set KeyEvent.FLAG_SOFT_KEYBOARD.
*/
void send_key_down_up(int keyCode)
{
send_keyevent(KeyEvent.ACTION_DOWN, keyCode);
send_keyevent(KeyEvent.ACTION_UP, keyCode);
send_key_down_up(keyCode, _meta_state);
}
void send_keyevent(int eventAction, int eventCode)
/** Ignores currently pressed system modifiers. */
void send_key_down_up(int keyCode, int metaState)
{
send_keyevent(KeyEvent.ACTION_DOWN, keyCode, metaState);
send_keyevent(KeyEvent.ACTION_UP, keyCode, metaState);
}
void send_keyevent(int eventAction, int eventCode, int metaState)
{
InputConnection conn = _recv.getCurrentInputConnection();
if (conn == null)
return;
conn.sendKeyEvent(new KeyEvent(1, 1, eventAction, eventCode, 0,
_meta_state, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
metaState, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE));
if (eventAction == KeyEvent.ACTION_UP)
_autocap.event_sent(eventCode, _meta_state);
_autocap.event_sent(eventCode, metaState);
}
void send_text(CharSequence text)
@@ -238,6 +239,8 @@ public final class KeyEventHandler
case REPLACE: send_context_menu_action(android.R.id.replaceText); break;
case ASSIST: send_context_menu_action(android.R.id.textAssist); break;
case AUTOFILL: send_context_menu_action(android.R.id.autofill); break;
case DELETE_WORD: send_key_down_up(KeyEvent.KEYCODE_DEL, KeyEvent.META_CTRL_ON | KeyEvent.META_CTRL_LEFT_ON); break;
case FORWARD_DELETE_WORD: send_key_down_up(KeyEvent.KEYCODE_FORWARD_DEL, KeyEvent.META_CTRL_ON | KeyEvent.META_CTRL_LEFT_ON); break;
}
}
@@ -319,6 +322,35 @@ public final class KeyEventHandler
send_key_down_up_repeat(KeyEvent.KEYCODE_DPAD_DOWN, d);
}
void evaluate_macro(KeyValue[] keys)
{
final Pointers.Modifiers empty = Pointers.Modifiers.EMPTY;
// Ignore modifiers that are activated at the time the macro is evaluated
mods_changed(empty);
Pointers.Modifiers mods = empty;
final boolean autocap_paused = _autocap.pause();
for (KeyValue kv : keys)
{
kv = KeyModifier.modify(kv, mods);
if (kv == null)
continue;
if (kv.hasFlagsAny(KeyValue.FLAG_LATCH))
{
// Non-special latchable keys clear latched modifiers
if (!kv.hasFlagsAny(KeyValue.FLAG_SPECIAL))
mods = empty;
mods = mods.with_extra_mod(kv);
}
else
{
key_down(kv, false);
key_up(kv, mods);
mods = empty;
}
}
_autocap.unpause(autocap_paused);
}
/** Repeat calls to [send_key_down_up]. */
void send_key_down_up_repeat(int event_code, int repeat)
{

View File

@@ -36,7 +36,7 @@ public final class KeyModifier
case Modifier:
return modify(k, mod.getModifier());
case Compose_pending:
return ComposeKey.apply(mod.getPendingCompose(), k);
return apply_compose_pending(mod.getPendingCompose(), k);
case Hangul_initial:
if (k.equals(mod)) // Allow typing the initial in letter form
return KeyValue.makeStringKey(k.getString(), KeyValue.FLAG_GREYED);
@@ -122,30 +122,44 @@ public final class KeyModifier
}
}
/** Keys that do not match any sequence are greyed. */
private static KeyValue apply_compose_pending(int state, KeyValue kv)
{
switch (kv.getKind())
{
case Char:
case String:
KeyValue res = ComposeKey.apply(state, kv);
// Grey-out characters not part of any sequence.
if (res == null)
return kv.withFlags(kv.getFlags() | KeyValue.FLAG_GREYED);
return res;
/* Tapping compose again exits the pending sequence. */
case Compose_pending:
return KeyValue.getKeyByName("compose_cancel");
/* These keys are not greyed. */
case Event:
case Modifier:
return kv;
/* Other keys cannot be part of sequences. */
default:
return kv.withFlags(kv.getFlags() | KeyValue.FLAG_GREYED);
}
}
/** Apply the given compose state or fallback to the dead_char. */
private static KeyValue apply_compose_or_dead_char(KeyValue k, int state, char dead_char)
{
switch (k.getKind())
{
case Char:
char c = k.getChar();
KeyValue r = ComposeKey.apply(state, c);
if (r != null)
return r;
}
KeyValue r = ComposeKey.apply(state, k);
if (r != null)
return r;
return apply_dead_char(k, dead_char);
}
private static KeyValue apply_compose(KeyValue k, int state)
{
switch (k.getKind())
{
case Char:
KeyValue r = ComposeKey.apply(state, k.getChar());
if (r != null)
return r;
}
return k;
KeyValue r = ComposeKey.apply(state, k);
return (r != null) ? r : k;
}
private static KeyValue apply_dead_char(KeyValue k, char dead_char)
@@ -179,18 +193,19 @@ public final class KeyModifier
if (mapped != null)
return mapped;
}
KeyValue r = ComposeKey.apply(ComposeKeyData.shift, k);
if (r != null)
return r;
switch (k.getKind())
{
case Char:
char kc = k.getChar();
KeyValue r = ComposeKey.apply(ComposeKeyData.shift, kc);
if (r != null)
return r;
char c = Character.toUpperCase(kc);
return (kc == c) ? k : k.withChar(c);
case String:
String s = Utils.capitalize_string(k.getString());
return KeyValue.makeStringKey(s, k.getFlags());
String ks = k.getString();
String s = Utils.capitalize_string(ks);
return s.equals(ks) ? k : KeyValue.makeStringKey(s, k.getFlags());
default: return k;
}
}
@@ -207,7 +222,8 @@ public final class KeyModifier
switch (k.getKind())
{
case Char:
KeyValue r = ComposeKey.apply(ComposeKeyData.fn, k.getChar());
case String:
KeyValue r = ComposeKey.apply(ComposeKeyData.fn, k);
return (r != null) ? r : k;
case Keyevent: name = apply_fn_keyevent(k.getKeyevent()); break;
case Event: name = apply_fn_event(k.getEvent()); break;
@@ -365,6 +381,13 @@ public final class KeyModifier
case SHIFT: name = "capslock"; break;
}
break;
case Keyevent:
switch (k.getKeyevent())
{
case KeyEvent.KEYCODE_DEL: name = "delete_word"; break;
case KeyEvent.KEYCODE_FORWARD_DEL: name = "forward_delete_word"; break;
}
break;
}
return (name == null) ? k : KeyValue.getKeyByName(name);
}

View File

@@ -75,6 +75,8 @@ public final class KeyValue implements Comparable<KeyValue>
SHARE,
ASSIST,
AUTOFILL,
DELETE_WORD,
FORWARD_DELETE_WORD,
}
public static enum Placeholder
@@ -95,7 +97,7 @@ public final class KeyValue implements Comparable<KeyValue>
Modifier, Editing, Placeholder,
String, // [_payload] is also the string to output, value is unused.
Slider, // [_payload] is a [KeyValue.Slider], value is slider repeatition.
StringWithSymbol, // [_payload] is a [KeyValue.StringWithSymbol], value is unused.
Macro, // [_payload] is a [KeyValue.Macro], value is unused.
}
private static final int FLAGS_OFFSET = 20;
@@ -105,7 +107,8 @@ public final class KeyValue implements Comparable<KeyValue>
public static final int FLAG_LATCH = (1 << FLAGS_OFFSET << 0);
// Key can be locked by typing twice when enabled in settings
public static final int FLAG_DOUBLE_TAP_LOCK = (1 << FLAGS_OFFSET << 1);
// Special keys are not repeated and don't clear latched modifiers.
// Special keys are not repeated.
// Special latchable keys don't clear latched modifiers.
public static final int FLAG_SPECIAL = (1 << FLAGS_OFFSET << 2);
// Whether the symbol should be greyed out. For example, keys that are not
// part of the pending compose sequence.
@@ -223,16 +226,17 @@ public final class KeyValue implements Comparable<KeyValue>
return ((int)(short)(_code & VALUE_BITS));
}
/** Defined only when [getKind() == Kind.StringWithSymbol]. */
public String getStringWithSymbol()
/** Defined only when [getKind() == Kind.Macro]. */
public KeyValue[] getMacro()
{
return ((StringWithSymbol)_payload).str;
return ((Macro)_payload).keys;
}
/* Update the char and the symbol. */
public KeyValue withChar(char c)
{
return new KeyValue(String.valueOf(c), Kind.Char, c, getFlags());
return new KeyValue(String.valueOf(c), Kind.Char, c,
getFlags() & ~(FLAG_KEY_FONT | FLAG_SMALLER_FONT));
}
public KeyValue withKeyevent(int code)
@@ -242,7 +246,31 @@ public final class KeyValue implements Comparable<KeyValue>
public KeyValue withFlags(int f)
{
return new KeyValue(_payload, (_code & KIND_BITS), (_code & VALUE_BITS), f);
return new KeyValue(_payload, _code, _code, f);
}
public KeyValue withSymbol(String symbol)
{
int flags = getFlags() & ~(FLAG_KEY_FONT | FLAG_SMALLER_FONT);
switch (getKind())
{
case Char:
case Keyevent:
case Event:
case Compose_pending:
case Hangul_initial:
case Hangul_medial:
case Modifier:
case Editing:
case Placeholder:
if (symbol.length() > 1)
flags |= FLAG_SMALLER_FONT;
return new KeyValue(symbol, _code, _code, flags);
case Macro:
return makeMacro(symbol, getMacro(), flags);
default:
return makeMacro(symbol, new KeyValue[]{ this }, flags);
}
}
@Override
@@ -286,7 +314,6 @@ public final class KeyValue implements Comparable<KeyValue>
return "[KeyValue " + getKind().toString() + "+" + getFlags() + "+" + value + " \"" + getString() + "\"]";
}
/** [value] is an unsigned integer. */
private KeyValue(Comparable p, int kind, int value, int flags)
{
if (p == null)
@@ -454,10 +481,11 @@ public final class KeyValue implements Comparable<KeyValue>
return new KeyValue(str, Kind.String, 0, flags | FLAG_SMALLER_FONT);
}
public static KeyValue makeStringKeyWithSymbol(String str, String symbol, int flags)
public static KeyValue makeMacro(String symbol, KeyValue[] keys, int flags)
{
return new KeyValue(new StringWithSymbol(str, symbol),
Kind.StringWithSymbol, 0, flags);
if (symbol.length() > 1)
flags |= FLAG_SMALLER_FONT;
return new KeyValue(new Macro(keys, symbol), Kind.Macro, 0, flags);
}
/** Make a modifier key for passing to [KeyModifier]. */
@@ -466,25 +494,24 @@ public final class KeyValue implements Comparable<KeyValue>
return new KeyValue("", Kind.Modifier, mod.ordinal(), 0);
}
public static KeyValue parseKeyDefinition(String str)
/** Return a key by its name. If the given name doesn't correspond to any
special key, it is parsed with [KeyValueParser]. */
public static KeyValue getKeyByName(String name)
{
if (str.length() < 2 || str.charAt(0) != ':')
return makeStringKey(str);
KeyValue k = getSpecialKeyByName(name);
if (k != null)
return k;
try
{
return KeyValueParser.parse(str);
return KeyValueParser.parse(name);
}
catch (KeyValueParser.ParseError _e)
{
return makeStringKey(str);
return makeStringKey(name);
}
}
/**
* Return a key by its name. If the given name doesn't correspond to a key
* defined in this function, it is passed to [parseStringKey] as a fallback.
*/
public static KeyValue getKeyByName(String name)
public static KeyValue getSpecialKeyByName(String name)
{
switch (name)
{
@@ -682,6 +709,8 @@ public final class KeyValue implements Comparable<KeyValue>
case "pasteAsPlainText": return editingKey(0xE035, Editing.PASTE_PLAIN);
case "undo": return editingKey(0xE036, Editing.UNDO);
case "redo": return editingKey(0xE037, Editing.REDO);
case "delete_word": return editingKey(0xE01B, Editing.DELETE_WORD);
case "forward_delete_word": return editingKey(0xE01C, Editing.FORWARD_DELETE_WORD);
case "cursor_left": return sliderKey(Slider.Cursor_left, 1);
case "cursor_right": return sliderKey(Slider.Cursor_right, 1);
case "cursor_up": return sliderKey(Slider.Cursor_up, 1);
@@ -735,8 +764,7 @@ public final class KeyValue implements Comparable<KeyValue>
case "": case "":
return makeStringKey(name, FLAG_SMALLER_FONT);
/* The key is not one of the special ones. */
default: return parseKeyDefinition(name);
default: return null;
}
}
@@ -747,29 +775,6 @@ public final class KeyValue implements Comparable<KeyValue>
throw new RuntimeException("Assertion failure");
}
public static final class StringWithSymbol implements Comparable<StringWithSymbol>
{
public final String str;
final String _symbol;
public StringWithSymbol(String _str, String _sym)
{
str = _str;
_symbol = _sym;
}
@Override
public String toString() { return _symbol; }
@Override
public int compareTo(StringWithSymbol snd)
{
int d = str.compareTo(snd.str);
if (d != 0) return d;
return _symbol.compareTo(snd._symbol);
}
};
public static enum Slider
{
Cursor_left(0xE008),
@@ -787,4 +792,31 @@ public final class KeyValue implements Comparable<KeyValue>
@Override
public String toString() { return symbol; }
};
public static final class Macro implements Comparable<Macro>
{
public final KeyValue[] keys;
private final String _symbol;
public Macro(KeyValue[] keys_, String sym_)
{
keys = keys_;
_symbol = sym_;
}
public String toString() { return _symbol; }
@Override
public int compareTo(Macro snd)
{
int d = keys.length - snd.keys.length;
if (d != 0) return d;
for (int i = 0; i < keys.length; i++)
{
d = keys[i].compareTo(snd.keys[i]);
if (d != 0) return d;
}
return _symbol.compareTo(snd._symbol);
}
};
}

View File

@@ -1,14 +1,22 @@
package juloo.keyboard2;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
Parse a key definition. The syntax for a key definition is:
- [(symbol):(key_action)]
- [:(kind) (attributes):(payload)].
- If [str] doesn't start with a [:] character, it is interpreted as an
arbitrary string key.
[key_action] is:
- ['Arbitrary string']
- [(key_action),(key_action),...]
- [keyevent:(code)]
- [(key_name)]
For the different kinds and attributes, see doc/Possible-key-values.md.
Examples:
@@ -18,103 +26,234 @@ Examples:
*/
public final class KeyValueParser
{
static Pattern START_PAT;
static Pattern ATTR_PAT;
static Pattern KEYDEF_TOKEN;
static Pattern QUOTED_PAT;
static Pattern PAYLOAD_START_PAT;
static Pattern WORD_PAT;
static public KeyValue parse(String str) throws ParseError
static public KeyValue parse(String input) throws ParseError
{
String symbol = null;
int flags = 0;
int symbol_ends = 0;
final int input_len = input.length();
while (symbol_ends < input_len && input.charAt(symbol_ends) != ':')
symbol_ends++;
if (symbol_ends == 0) // Old syntax
return Starting_with_colon.parse(input);
if (symbol_ends == input_len) // String key
return KeyValue.makeStringKey(input);
String symbol = input.substring(0, symbol_ends);
init();
// Kind
Matcher m = START_PAT.matcher(str);
if (!m.lookingAt())
parseError("Expected kind, for example \":str ...\".", m);
String kind = m.group(1);
// Attributes
while (true)
{
if (!match(m, ATTR_PAT))
break;
String attr_name = m.group(1);
String attr_value = parseSingleQuotedString(m);
switch (attr_name)
{
case "flags":
flags = parseFlags(attr_value, m);
break;
case "symbol":
symbol = attr_value;
break;
default:
parseError("Unknown attribute "+attr_name, m);
}
}
// Payload
if (!match(m, PAYLOAD_START_PAT))
parseError("Unexpected character", m);
String payload;
switch (kind)
{
case "str":
payload = parseSingleQuotedString(m);
if (symbol == null)
return KeyValue.makeStringKey(payload, flags);
return KeyValue.makeStringKeyWithSymbol(payload, symbol, flags);
case "char":
payload = parsePayloadWord(m);
if (payload.length() != 1)
parseError("Expected a single character payload", m);
return KeyValue.makeCharKey(payload.charAt(0), symbol, flags);
case "keyevent":
payload = parsePayloadWord(m);
int eventcode = 0;
try { eventcode = Integer.parseInt(payload); }
catch (Exception _e)
{ parseError("Expected an integer payload", m); }
if (symbol == null)
symbol = String.valueOf(eventcode);
return KeyValue.keyeventKey(symbol, eventcode, flags);
default: break;
}
parseError("Unknown kind '"+kind+"'", m, 1);
return null; // Unreachable
Matcher m = KEYDEF_TOKEN.matcher(input);
m.region(symbol_ends + 1, input_len);
KeyValue first_key = parse_key_def(m);
if (!parse_comma(m)) // Input is a single key def with a specified symbol
return first_key.withSymbol(symbol);
// Input is a macro
ArrayList<KeyValue> keydefs = new ArrayList<KeyValue>();
keydefs.add(first_key);
do { keydefs.add(parse_key_def(m)); }
while (parse_comma(m));
return KeyValue.makeMacro(symbol, keydefs.toArray(new KeyValue[]{}), 0);
}
static String parseSingleQuotedString(Matcher m) throws ParseError
static void init()
{
if (KEYDEF_TOKEN != null)
return;
KEYDEF_TOKEN = Pattern.compile("'|,|keyevent:|(?:[^\\\\',]+|\\\\.)+");
QUOTED_PAT = Pattern.compile("((?:[^'\\\\]+|\\\\')*)'");
WORD_PAT = Pattern.compile("[a-zA-Z0-9_]+|.");
}
static KeyValue key_by_name_or_str(String str)
{
KeyValue k = KeyValue.getSpecialKeyByName(str);
if (k != null)
return k;
return KeyValue.makeStringKey(str);
}
static KeyValue parse_key_def(Matcher m) throws ParseError
{
if (!match(m, KEYDEF_TOKEN))
parseError("Expected key definition", m);
String token = m.group(0);
switch (token)
{
case "'": return parse_string_keydef(m);
case ",": parseError("Unexpected comma", m); return null;
case "keyevent:": return parse_keyevent_keydef(m);
default: return key_by_name_or_str(remove_escaping(token));
}
}
static KeyValue parse_string_keydef(Matcher m) throws ParseError
{
if (!match(m, QUOTED_PAT))
parseError("Expected quoted string", m);
return m.group(1).replace("\\'", "'");
parseError("Unterminated quoted string", m);
return KeyValue.makeStringKey(remove_escaping(m.group(1)));
}
static String parsePayloadWord(Matcher m) throws ParseError
static KeyValue parse_keyevent_keydef(Matcher m) throws ParseError
{
if (!match(m, WORD_PAT))
parseError("Expected a word after ':' made of [a-zA-Z0-9_]", m);
return m.group(0);
parseError("Expected keyevent code", m);
int eventcode = 0;
try { eventcode = Integer.parseInt(m.group(0)); }
catch (Exception _e)
{ parseError("Expected an integer payload", m); }
return KeyValue.keyeventKey("", eventcode, 0);
}
static int parseFlags(String s, Matcher m) throws ParseError
/** Returns [true] if the next token is a comma, [false] if it is the end of the input. Throws an error otherwise. */
static boolean parse_comma(Matcher m) throws ParseError
{
int flags = 0;
for (String f : s.split(","))
{
switch (f)
if (!match(m, KEYDEF_TOKEN))
return false;
String token = m.group(0);
if (!token.equals(","))
parseError("Expected comma instead of '"+ token + "'", m);
return true;
}
static String remove_escaping(String s)
{
if (!s.contains("\\"))
return s;
StringBuilder out = new StringBuilder(s.length());
final int len = s.length();
int prev = 0, i = 0;
for (; i < len; i++)
if (s.charAt(i) == '\\')
{
case "dim": flags |= KeyValue.FLAG_SECONDARY; break;
case "small": flags |= KeyValue.FLAG_SMALLER_FONT; break;
default: parseError("Unknown flag "+f, m);
out.append(s, prev, i);
prev = i + 1;
}
out.append(s, prev, i);
return out.toString();
}
/**
Parse a key definition starting with a [:]. This is the old syntax and is
kept for compatibility.
*/
final static class Starting_with_colon
{
static Pattern START_PAT;
static Pattern ATTR_PAT;
static Pattern QUOTED_PAT;
static Pattern PAYLOAD_START_PAT;
static Pattern WORD_PAT;
static public KeyValue parse(String str) throws ParseError
{
String symbol = null;
int flags = 0;
init();
// Kind
Matcher m = START_PAT.matcher(str);
if (!m.lookingAt())
parseError("Expected kind, for example \":str ...\".", m);
String kind = m.group(1);
// Attributes
while (true)
{
if (!match(m, ATTR_PAT))
break;
String attr_name = m.group(1);
String attr_value = parseSingleQuotedString(m);
switch (attr_name)
{
case "flags":
flags = parseFlags(attr_value, m);
break;
case "symbol":
symbol = attr_value;
break;
default:
parseError("Unknown attribute "+attr_name, m);
}
}
// Payload
if (!match(m, PAYLOAD_START_PAT))
parseError("Unexpected character", m);
String payload;
switch (kind)
{
case "str":
payload = parseSingleQuotedString(m);
if (symbol == null)
return KeyValue.makeStringKey(payload, flags);
return KeyValue.makeStringKey(payload, flags).withSymbol(symbol);
case "char":
payload = parsePayloadWord(m);
if (payload.length() != 1)
parseError("Expected a single character payload", m);
return KeyValue.makeCharKey(payload.charAt(0), symbol, flags);
case "keyevent":
payload = parsePayloadWord(m);
int eventcode = 0;
try { eventcode = Integer.parseInt(payload); }
catch (Exception _e)
{ parseError("Expected an integer payload", m); }
if (symbol == null)
symbol = String.valueOf(eventcode);
return KeyValue.keyeventKey(symbol, eventcode, flags);
default: break;
}
parseError("Unknown kind '"+kind+"'", m, 1);
return null; // Unreachable
}
static String parseSingleQuotedString(Matcher m) throws ParseError
{
if (!match(m, QUOTED_PAT))
parseError("Expected quoted string", m);
return m.group(1).replace("\\'", "'");
}
static String parsePayloadWord(Matcher m) throws ParseError
{
if (!match(m, WORD_PAT))
parseError("Expected a word after ':' made of [a-zA-Z0-9_]", m);
return m.group(0);
}
static int parseFlags(String s, Matcher m) throws ParseError
{
int flags = 0;
for (String f : s.split(","))
{
switch (f)
{
case "dim": flags |= KeyValue.FLAG_SECONDARY; break;
case "small": flags |= KeyValue.FLAG_SMALLER_FONT; break;
default: parseError("Unknown flag "+f, m);
}
}
return flags;
}
static boolean match(Matcher m, Pattern pat)
{
try { m.region(m.end(), m.regionEnd()); } catch (Exception _e) {}
m.usePattern(pat);
return m.lookingAt();
}
static void init()
{
if (START_PAT != null)
return;
START_PAT = Pattern.compile(":(\\w+)");
ATTR_PAT = Pattern.compile("\\s*(\\w+)\\s*=");
QUOTED_PAT = Pattern.compile("'(([^'\\\\]+|\\\\')*)'");
PAYLOAD_START_PAT = Pattern.compile("\\s*:");
WORD_PAT = Pattern.compile("[a-zA-Z0-9_]*");
}
return flags;
}
static boolean match(Matcher m, Pattern pat)
@@ -124,17 +263,6 @@ public final class KeyValueParser
return m.lookingAt();
}
static void init()
{
if (START_PAT != null)
return;
START_PAT = Pattern.compile(":(\\w+)");
ATTR_PAT = Pattern.compile("\\s*(\\w+)\\s*=");
QUOTED_PAT = Pattern.compile("'(([^'\\\\]+|\\\\')*)'");
PAYLOAD_START_PAT = Pattern.compile("\\s*:");
WORD_PAT = Pattern.compile("[a-zA-Z0-9_]*");
}
static void parseError(String msg, Matcher m) throws ParseError
{
parseError(msg, m, m.regionStart());
@@ -145,8 +273,7 @@ public final class KeyValueParser
StringBuilder msg_ = new StringBuilder("Syntax error");
try
{
char c = m.group(0).charAt(0);
msg_.append(" at character '").append(c).append("'");
msg_.append(" at token '").append(m.group(0)).append("'");
} catch (IllegalStateException _e) {}
msg_.append(" at position ");
msg_.append(i);

View File

@@ -296,15 +296,15 @@ public class Keyboard2View extends View
DisplayMetrics dm = getContext().getResources().getDisplayMetrics();
width = dm.widthPixels;
}
int height =
(int)(_config.keyHeight * _keyboard.keysHeight
+ _config.marginTop + _marginBottom);
setMeasuredDimension(width, height);
_marginLeft = Math.max(_config.horizontal_margin, insets_left);
_marginRight = Math.max(_config.horizontal_margin, insets_right);
_marginBottom = _config.margin_bottom + insets_bottom;
_keyWidth = (width - _marginLeft - _marginRight) / _keyboard.keysWidth;
_tc = new Theme.Computed(_theme, _config, _keyWidth);
int height =
(int)(_config.keyHeight * _keyboard.keysHeight
+ _config.marginTop + _marginBottom);
setMeasuredDimension(width, height);
}
@Override

View File

@@ -138,15 +138,8 @@ public final class LayoutModifier
return new KeyboardData.MapKeyValues() {
public KeyValue apply(KeyValue key, boolean localized)
{
switch (key.getKind())
{
case Char:
KeyValue modified = ComposeKey.apply(map_digit, key.getChar());
if (modified != null)
return modified;
break;
}
return key;
KeyValue modified = ComposeKey.apply(map_digit, key);
return (modified != null) ? modified : key;
}
};
}

View File

@@ -11,6 +11,7 @@ import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import android.widget.ArrayAdapter;
import android.widget.Toast;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.List;
@@ -70,6 +71,8 @@ class VoiceImeSwitcher
}
})
.create();
if (ime_display_names.size() == 0)
dialog.setMessage(ims.getResources().getString(R.string.toast_no_voice_input));
Utils.show_dialog_on_ime(dialog, ims.getWindow().getWindow().getDecorView().getWindowToken());
}

View File

@@ -41,7 +41,7 @@ public class CustomExtraKeysPreference extends ListGroupPreference<String>
if (key_names != null)
{
for (String key_name : key_names)
kvs.put(KeyValue.parseKeyDefinition(key_name), KeyboardData.PreferredPos.DEFAULT);
kvs.put(KeyValue.getKeyByName(key_name), KeyboardData.PreferredPos.DEFAULT);
}
return kvs;
}

View File

@@ -72,6 +72,8 @@ public class ExtraKeysPreference extends PreferenceCategory
"pasteAsPlainText",
"undo",
"redo",
"delete_word",
"forward_delete_word",
"superscript",
"subscript",
"f11_placeholder",
@@ -177,6 +179,14 @@ public class ExtraKeysPreference extends PreferenceCategory
id = R.string.key_descr_redo;
additional_info = format_key_combination(new String[]{"fn", "undo"});
break;
case "delete_word":
id = R.string.key_descr_delete_word;
additional_info = format_key_combination_gesture(res, "backspace");
break;
case "forward_delete_word":
id = R.string.key_descr_forward_delete_word;
additional_info = format_key_combination_gesture(res, "forward_delete");
break;
case "selectAll": id = R.string.key_descr_selectAll; break;
case "shareText": id = R.string.key_descr_shareText; break;
case "subscript": id = R.string.key_descr_subscript; break;
@@ -276,6 +286,7 @@ public class ExtraKeysPreference extends PreferenceCategory
return kv.getString();
}
/** Format a key combination */
static String format_key_combination(String[] keys)
{
StringBuilder out = new StringBuilder();
@@ -287,6 +298,13 @@ public class ExtraKeysPreference extends PreferenceCategory
return out.toString();
}
/** Explain a gesture on a key */
static String format_key_combination_gesture(Resources res, String key_name)
{
return res.getString(R.string.key_descr_gesture) + " + "
+ KeyValue.getKeyByName(key_name).getString();
}
static KeyboardData.PreferredPos key_preferred_pos(String key_name)
{
switch (key_name)
@@ -341,6 +359,16 @@ public class ExtraKeysPreference extends PreferenceCategory
new KeyboardData.KeyPos(0, -1, 3),
new KeyboardData.KeyPos(0, -1, 4),
});
case "delete_word":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("backspace"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(-1, -1, 3),
});
case "forward_delete_word":
return new KeyboardData.PreferredPos(KeyValue.getKeyByName("backspace"),
new KeyboardData.KeyPos[]{
new KeyboardData.KeyPos(-1, -1, 4),
});
}
return KeyboardData.PreferredPos.DEFAULT;
}

View File

@@ -8,32 +8,32 @@
<fn a="у" b="у̂" />
<fn a="cursor_left" b="home" />
<fn a="cursor_right" b="end" />
<ctrl a="љ" b=":char symbol='љ':q" />
<ctrl a="њ" b=":char symbol='њ':w" />
<ctrl a="е" b=":char symbol='е':e" />
<ctrl a="р" b=":char symbol='р':r" />
<ctrl a="т" b=":char symbol='т':t" />
<ctrl a="ж" b=":char symbol='ж':y" />
<ctrl a="у" b=":char symbol='у':u" />
<ctrl a="и" b=":char symbol='и':i" />
<ctrl a="о" b=":char symbol='о':o" />
<ctrl a="п" b=":char symbol='п':p" />
<ctrl a="а" b=":char symbol='а':a" />
<ctrl a="с" b=":char symbol='с':s" />
<ctrl a="д" b=":char symbol='д':d" />
<ctrl a="ф" b=":char symbol='ф':f" />
<ctrl a="г" b=":char symbol='г':g" />
<ctrl a="х" b=":char symbol='х':h" />
<ctrl a="ј" b=":char symbol='ј':j" />
<ctrl a="к" b=":char symbol='к':k" />
<ctrl a="л" b=":char symbol='л':l" />
<ctrl a="з" b=":char symbol='з':z" />
<ctrl a="џ" b=":char symbol='џ':x" />
<ctrl a="ц" b=":char symbol='ц':c" />
<ctrl a="в" b=":char symbol='в':v" />
<ctrl a="б" b=":char symbol='б':b" />
<ctrl a="н" b=":char symbol='н':n" />
<ctrl a="м" b=":char symbol='м':m" />
<ctrl a="љ" b="љ:q" />
<ctrl a="њ" b="њ:w" />
<ctrl a="е" b="е:e" />
<ctrl a="р" b="р:r" />
<ctrl a="т" b="т:t" />
<ctrl a="ж" b="ж:y" />
<ctrl a="у" b="у:u" />
<ctrl a="и" b="и:i" />
<ctrl a="о" b="о:o" />
<ctrl a="п" b="п:p" />
<ctrl a="а" b="а:a" />
<ctrl a="с" b="с:s" />
<ctrl a="д" b="д:d" />
<ctrl a="ф" b="ф:f" />
<ctrl a="г" b="г:g" />
<ctrl a="х" b="х:h" />
<ctrl a="ј" b="ј:j" />
<ctrl a="к" b="к:k" />
<ctrl a="л" b="л:l" />
<ctrl a="з" b="з:z" />
<ctrl a="џ" b="џ:x" />
<ctrl a="ц" b="ц:c" />
<ctrl a="в" b="в:v" />
<ctrl a="б" b="б:b" />
<ctrl a="н" b="н:n" />
<ctrl a="м" b="м:m" />
</modmap>
<row>
<key key0="љ" ne="1" se="loc esc"/>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard name="QWERTY (APL)" script="latin" embedded_number_row="true">
<row height="0.75">
<key c="1" nw="⌶" ne="¨" se="!"/>
<key c="2" nw="¯" ne="⍫" se="@" sw="`"/>
<key c="3" nw="&lt;" ne="⍒" se="#" sw="~"/>
<key c="4" nw="≤" ne="⍋" se="$"/>
<key c="5" nw="=" ne="⌽" se="%"/>
<key c="6" nw="≥" ne="⍉" sw="^"/>
<key c="7" nw=">" ne="⊖" sw="&amp;" se="|"/>
<key c="8" nw="≠" ne="⍟" se="∞" sw="*"/>
<key c="9" nw="" ne="⍱" sw="("/>
<key c="0" nw="∧" ne="⍲" sw=")"/>
</row>
<row>
<key c="q" ne="?" se="loc esc"/>
<key c="w" ne="⍵" sw="'" se="&quot;"/>
<key c="e" nw="∊" ne="⍷"/>
<key c="r" nw="" sw="←"/>
<key c="t" nw="⍨" se="→"/>
<key c="y" nw="↑" ne="⌹" se="÷" sw="-"/>
<key c="u" nw="↓" ne="⍮" se="×" sw="+"/>
<key c="i" nw="" ne="⍸" sw="[" se="{"/>
<key c="o" nw="○" ne="⍥" sw="]" se="}"/>
<key c="p" nw="⍣" sw="⍬"/>
</row>
<row>
<key c="a" ne="" se="loc tab"/>
<key c="s" nw="⌈" ne="ᑈ" se="«"/>
<key c="d" nw="⌊" ne="ᐵ" se="»"/>
<key c="f" s="…"/>
<key c="g" nw="∇" s="_"/>
<key c="h" nw="∆"/>
<key c="j" nw="∘" ne="⍤" w="⊣" e="⊢"/>
<key c="k" ne="⌸"/>
<key c="l" nw="⎕" ne="⌷" se="⍪"/>
<key c=";" n="⋄" s=","/>
</row>
<row>
<key c="shift" e="loc capslock"/>
<key c="z" nw="⊂" se="⍝"/>
<key c="x" nw="⊃"/>
<key c="c" nw="∩" ne="⍛" sw="." se=":"/>
<key c="v" nw="" ne="√"/>
<key c="b" nw="⊥" ne="⍎" sw="⌿" se="⍀"/>
<key c="n" nw="" ne="⍕" sw="/" se="\\"/>
<key c="m" nw="≡" ne="≢" sw="∥" se="⍠"/>
<key width="2" c="backspace" e="delete"/>
</row>
</keyboard>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<keyboard name="QWERTY (BQN)" script="latin" embedded_number_row="true">
<row height="0.75">
<key c="1" nw="˘" ne="⎉" se="!"/>
<key c="2" nw="¨" ne="⚇" se="@" sw="`"/>
<key c="3" nw="⁼" ne="⍟" se="#" sw="~"/>
<key c="4" nw="⌜" ne="◶" se="$"/>
<key c="5" nw="´" ne="⊘" se="%"/>
<key c="6" nw="˝" ne="⎊" sw="^"/>
<key c="7" sw="&amp;" se="|"/>
<key c="8" nw="∞" sw="*" se="\\"/>
<key c="9" nw="⟨" ne="¯" sw="("/>
<key c="0" nw="⟩" ne="•" sw=")"/>
</row>
<row>
<key c="q" nw="⌽" ne="˜" se="loc esc"/>
<key c="w" nw="𝕨" sw="'" se="&quot;"/>
<key c="e" nw="∊" ne="⍷"/>
<key c="r" nw="↑" ne="𝕣" sw="←" se="⇐"/>
<key c="t" nw="∧" ne="⍋" sw="↩&#xFE0E;:↩" se="→"/>
<key c="y" nw="¬" ne="√" se="÷" sw="-"/>
<key c="u" nw="⊔" ne="⋆" se="×" sw="+"/>
<key c="i" nw="⊏" ne="⊑" sw="[" se="{"/>
<key c="o" nw="⊐" ne="⊒" sw="]" se="}"/>
<key c="p" nw="π" ne=""/>
</row>
<row>
<key c="a" ne="⍉" se="loc tab"/>
<key c="s" nw="𝕤"/>
<key c="d" nw="↕&#xFE0E;:↕" se="∾"/>
<key c="f" nw="𝕗" se="≍"/>
<key c="g" nw="𝕘" s="_"/>
<key c="h" nw="⊸" ne="«"/>
<key c="j" nw="∘" w="⊣" e="⊢"/>
<key c="k" nw="○" ne="⌾"/>
<key c="l" nw="⟜" ne="»"/>
<key c=";" w="·" n="⋄" s=","/>
</row>
<row>
<key c="shift" e="loc capslock"/>
<key c="z" nw="⥊" ne="⋈"/>
<key c="x" nw="𝕩"/>
<key c="c" nw="↓" ne="˙" sw="." se=":"/>
<key c="v" nw="" ne="⍒" s="‿"/>
<key c="b" s="⌊" n="⌈"/>
<key c="n" nw="≤" ne="≥" n="≠" sw="&lt;" se="&gt;" s="="/>
<key c="m" nw="≡" ne="≢" sw="/" se="?"/>
<key width="2" c="backspace" e="delete"/>
</row>
</keyboard>

18
srcs/special_font/01B.svg Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Based on materialdesignicons.com backspace-outline -->
<svg
version="1.1"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<path
id="text3"
style="font-weight:600;font-size:13.3333px;font-family:FreeSans;-inkscape-font-specification:'FreeSans Semi-Bold'"
d="m 17.517249,16.883978 c -0.599999,0 -1.199997,0 -1.799996,0 -0.542221,-2.528883 -1.084441,-5.057765 -1.626662,-7.5866476 -0.528888,2.5288826 -1.057775,5.0577646 -1.586663,7.5866476 -0.599998,0 -1.199997,0 -1.799995,0 -0.9155533,-3.239992 -1.8311066,-6.479984 -2.7466599,-9.7199755 0.706665,0 1.4133299,0 2.1199949,0 0.502221,2.4266605 1.004442,4.8533215 1.506663,7.2799815 0.502221,-2.426661 1.004441,-4.853321 1.506662,-7.2799815 0.657776,0 1.315553,0 1.973329,0 0.524443,2.4311048 1.048886,4.8622095 1.573329,7.2933145 0.484443,-2.431105 0.968887,-4.8622097 1.45333,-7.2933145 0.706665,0 1.413329,0 2.119994,0 C 19.3128,10.403994 18.415024,13.643986 17.517249,16.883978 Z M 22,3 c 1.232984,-0.040548 2.168377,1.1810823 2,2.36 -0.0069,4.6147431 0.01374,9.230179 -0.01033,13.844488 C 23.906211,20.390581 22.701093,21.155835 21.58,21 16.677486,20.9972 11.77479,21.0056 6.8723901,20.9958 5.6427252,20.925088 5.1783178,19.667046 4.5442984,18.812248 3.0295323,16.541498 1.5147661,14.270749 0,12 1.8548324,9.2326362 3.6795639,6.4439141 5.5533789,3.6900195 6.2693382,2.7489141 7.4877473,3.0506966 8.5000001,3 13,3 17.5,3 22,3 Z m 0,2 C 17,5 12,5 7,5 5.4266667,7.3333333 3.8533333,9.6666667 2.28,12 c 1.5733333,2.333333 3.1466667,4.666667 4.72,7 5,0 10,0 15,0 0,-4.666667 0,-9.3333333 0,-14 z" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

18
srcs/special_font/01C.svg Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Based on materialdesignicons.com backspace-reverse-outline -->
<svg
version="1.1"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg1"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs1" />
<path
id="text3"
style="font-weight:600;font-size:13.3333px;font-family:FreeSans;-inkscape-font-specification:'FreeSans Semi-Bold'"
d="m 13.559976,16.719975 c -0.599999,0 -1.199997,0 -1.799996,0 -0.542221,-2.528883 -1.084441,-5.057765 -1.626662,-7.586648 -0.5288876,2.528883 -1.0577752,5.057765 -1.5866628,7.586648 -0.5999985,0 -1.1999969,0 -1.7999954,0 -0.9155532,-3.239992 -1.8311065,-6.479984 -2.7466597,-9.7199759 0.7066649,0 1.4133297,0 2.1199946,0 0.502221,2.4266606 1.0044419,4.8533209 1.5066629,7.2799819 0.5022209,-2.426661 1.0044419,-4.8533213 1.5066628,-7.2799819 0.6577762,0 1.3155526,0 1.9733286,0 0.524443,2.431105 1.048886,4.8622099 1.573329,7.2933149 0.484443,-2.431105 0.968887,-4.8622099 1.45333,-7.2933149 0.706665,0 1.413329,0 2.119994,0 -0.897775,3.2399919 -1.795551,6.4799839 -2.693326,9.7199759 z M 2,3 C 0.76701608,2.9594518 -0.16837714,4.1810822 0,5.36 0.00686259,9.9747431 -0.01373935,14.590179 0.01032577,19.204488 0.09378911,20.390581 1.2989069,21.155835 2.42,21 c 4.902514,-0.0028 9.80521,0.0056 14.70761,-0.0042 1.229665,-0.07074 1.694072,-1.328782 2.328092,-2.18358 C 20.970468,16.541498 22.485234,14.270749 24,12 22.145168,9.2326362 20.320436,6.4439141 18.446621,3.6900195 17.730662,2.7489141 16.512253,3.0506966 15.5,3 11,3 6.5,3 2,3 Z m 0,2 c 5,0 10,0 15,0 1.573333,2.3333333 3.146667,4.6666667 4.72,7 C 20.146667,14.333333 18.573333,16.666667 17,19 12,19 7,19 2,19 2,14.333333 2,9.6666667 2,5 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -42,22 +42,21 @@ public class ComposeKeyTest
assertEquals(apply("", state), KeyValue.makeStringKey("", KeyValue.FLAG_SMALLER_FONT));
}
KeyValue apply(String seq) throws Exception
@Test
public void stringKeys() throws Exception
{
return apply(seq, ComposeKeyData.compose);
int state = ComposeKeyData.shift;
assertEquals(apply("𝕨", state), KeyValue.makeStringKey("𝕎"));
assertEquals(apply("𝕩", state), KeyValue.makeStringKey("𝕏"));
}
KeyValue apply(String seq, int state) throws Exception
KeyValue apply(String seq)
{
KeyValue r = null;
for (int i = 0; i < seq.length(); i++)
{
r = ComposeKey.apply(state, seq.charAt(i));
if (r.getKind() == KeyValue.Kind.Compose_pending)
state = r.getPendingCompose();
else if (i + 1 < seq.length())
throw new Exception("Sequence too long: " + seq);
}
return r;
return ComposeKey.apply(ComposeKeyData.compose, seq);
}
KeyValue apply(String seq, int state)
{
return ComposeKey.apply(state, seq);
}
}

View File

@@ -10,12 +10,109 @@ public class KeyValueParserTest
public KeyValueParserTest() {}
@Test
public void parseStr() throws Exception
public void parse_key_value() throws Exception
{
Utils.parse("'", KeyValue.makeStringKey("'"));
Utils.parse("\\'", KeyValue.makeStringKey("\\'"));
Utils.parse("\\,", KeyValue.makeStringKey("\\,"));
Utils.parse("a\\'b", KeyValue.makeStringKey("a\\'b"));
Utils.parse("a\\,b", KeyValue.makeStringKey("a\\,b"));
Utils.parse("a", KeyValue.makeStringKey("a"));
Utils.parse("abc", KeyValue.makeStringKey("abc"));
Utils.parse("shift", KeyValue.getSpecialKeyByName("shift"));
Utils.parse("'a", KeyValue.makeStringKey("'a"));
}
@Test
public void parse_macro() throws Exception
{
Utils.parse("copy:ctrl,a,ctrl,c", KeyValue.makeMacro("copy", new KeyValue[]{
KeyValue.getSpecialKeyByName("ctrl"),
KeyValue.makeStringKey("a"),
KeyValue.getSpecialKeyByName("ctrl"),
KeyValue.makeStringKey("c")
}, 0));
Utils.parse("macro:abc,\\'", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.makeStringKey("abc"),
KeyValue.makeStringKey("'")
}, 0));
Utils.parse("macro:abc,\\,", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.makeStringKey("abc"),
KeyValue.makeStringKey(",")
}, 0));
Utils.parse("<2:ctrl,backspace", KeyValue.makeMacro("<2", new KeyValue[]{
KeyValue.getSpecialKeyByName("ctrl"),
KeyValue.getSpecialKeyByName("backspace")
}, 0));
Utils.expect_error("symbol:");
Utils.expect_error("unterminated_string:'");
Utils.expect_error("unterminated_string:abc,'");
Utils.expect_error("unexpected_quote:abc,,");
Utils.expect_error("unexpected_quote:,");
}
@Test
/* Using the [symbol:..] syntax but not resulting in a macro. */
public void parse_non_macro() throws Exception
{
Utils.parse("a:b", KeyValue.makeCharKey('b', "a", 0));
Utils.parse("symbol:abc", KeyValue.makeStringKey("abc").withSymbol("symbol"));
}
@Test
public void parse_string_key() throws Exception
{
Utils.parse("symbol:'str'", KeyValue.makeMacro("symbol", new KeyValue[]{
KeyValue.makeStringKey("str")
}, 0));
Utils.parse("symbol:'str\\''", KeyValue.makeMacro("symbol", new KeyValue[]{
KeyValue.makeStringKey("str'")
}, 0));
Utils.parse("macro:'str',abc", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.makeStringKey("str"),
KeyValue.makeStringKey("abc")
}, 0));
Utils.parse("macro:abc,'str'", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.makeStringKey("abc"),
KeyValue.makeStringKey("str")
}, 0));
Utils.parse("macro:\\',\\,", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.makeStringKey("'"),
KeyValue.makeStringKey(","),
}, 0));
Utils.parse("macro:a\\'b,a\\,b,a\\xb", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.makeStringKey("a'b"),
KeyValue.makeStringKey("a,b"),
KeyValue.makeStringKey("axb")
}, 0));
Utils.expect_error("symbol:'");
Utils.expect_error("symbol:'foo");
}
@Test
public void parse_key_event() throws Exception
{
Utils.parse("a:keyevent:85", KeyValue.keyeventKey("a", 85, 0));
Utils.parse("symbol:keyevent:85", KeyValue.keyeventKey("symbol", 85, KeyValue.FLAG_SMALLER_FONT));
Utils.parse("macro:keyevent:85,abc", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.keyeventKey("", 85, 0),
KeyValue.makeStringKey("abc")
}, 0));
Utils.parse("macro:abc,keyevent:85", KeyValue.makeMacro("macro", new KeyValue[]{
KeyValue.makeStringKey("abc"),
KeyValue.keyeventKey("", 85, 0)
}, 0));
Utils.expect_error("symbol:keyevent:");
Utils.expect_error("symbol:keyevent:85a");
}
@Test
public void parse_old_syntax() throws Exception
{
Utils.parse(":str:'Foo'", KeyValue.makeStringKey("Foo"));
Utils.parse(":str flags='dim':'Foo'", KeyValue.makeStringKey("Foo", KeyValue.FLAG_SECONDARY));
Utils.parse(":str symbol='Symbol':'Foo'", KeyValue.makeStringKeyWithSymbol("Foo", "Symbol", 0));
Utils.parse(":str symbol='Symbol' flags='dim':'Foo'", KeyValue.makeStringKeyWithSymbol("Foo", "Symbol", KeyValue.FLAG_SECONDARY));
Utils.parse(":str symbol='Symbol':'Foo'", KeyValue.makeStringKey("Foo").withSymbol("Symbol"));
Utils.parse(":str symbol='Symbol' flags='dim':'f'", KeyValue.makeStringKey("f").withSymbol("Symbol").withFlags(KeyValue.FLAG_SECONDARY | KeyValue.FLAG_SMALLER_FONT));
Utils.parse(":str flags='dim,small':'Foo'", KeyValue.makeStringKey("Foo", KeyValue.FLAG_SECONDARY | KeyValue.FLAG_SMALLER_FONT));
Utils.parse(":str flags=',,':'Foo'", KeyValue.makeStringKey("Foo")); // Unintentional
Utils.expect_error(":unknown:Foo"); // Unknown kind
@@ -32,11 +129,7 @@ public class KeyValueParserTest
Utils.expect_error(":str flags='' ");
Utils.expect_error(":str flags='':");
Utils.expect_error(":str flags='':'");
}
@Test
public void parseChar() throws Exception
{
// Char
Utils.parse(":char symbol='a':b", KeyValue.makeCharKey('b', "a", 0));
Utils.parse(":char:b", KeyValue.makeCharKey('b', "b", 0));
}
@@ -46,7 +139,7 @@ public class KeyValueParserTest
{
static void parse(String key_descr, KeyValue ref) throws Exception
{
assertEquals(ref, KeyValueParser.parse(key_descr));
assertEquals(ref, KeyValue.getKeyByName(key_descr));
}
static void expect_error(String key_descr)

View File

@@ -1,5 +1,6 @@
package juloo.keyboard2;
import android.view.KeyEvent;
import juloo.keyboard2.KeyValue;
import org.junit.Test;
import static org.junit.Assert.*;
@@ -11,7 +12,14 @@ public class KeyValueTest
@Test
public void equals()
{
assertEquals(KeyValue.makeStringKeyWithSymbol("Foo", "Symbol", 0), KeyValue.makeStringKeyWithSymbol("Foo", "Symbol", 0));
assertEquals(KeyValue.makeStringKey("Foo").withSymbol("Symbol"),
KeyValue.makeMacro("Symbol", new KeyValue[] { KeyValue.makeStringKey("Foo") }, 0));
assertEquals(KeyValue.getSpecialKeyByName("tab"),
KeyValue.keyeventKey(0xE00F, KeyEvent.KEYCODE_TAB, KeyValue.FLAG_KEY_FONT | KeyValue.FLAG_SMALLER_FONT));
assertEquals(KeyValue.getSpecialKeyByName("tab").withSymbol("t"),
KeyValue.keyeventKey("t", KeyEvent.KEYCODE_TAB, 0));
assertEquals(KeyValue.getSpecialKeyByName("tab").withSymbol("tab"),
KeyValue.keyeventKey("tab", KeyEvent.KEYCODE_TAB, KeyValue.FLAG_SMALLER_FONT));
}
@Test