Commit Graph

12 Commits

Author SHA1 Message Date
Jules Aguillon
eddf9c6c11 Refactor: New namespace for preference classes 2024-01-13 20:59:05 +01:00
Jules Aguillon
92a8db5e93 Update auto-capitalisation state when input starts
The initial capitalisation state given by the editor
(`info.initialCapsMode`) is always 0 in many editors.

For some text input types, update the state when typing starts,
disregarding the value given by `info.initialCapsMode`.
2023-09-09 14:15:44 +02:00
Jules Aguillon
f4c11d99ed Disable automatically Shift when pressing Ctrl
Automatic capitalisation might interferes with keyboard shortcuts.
2023-08-26 23:37:22 +02:00
Jules Aguillon
078dbcd5ff Refactor: Move editing code from to KeyEventHandler
Remove the code dealing with InputMethodConnection from 'Keyboard2' and
move it into 'KeyEventHandler', where more editing actions can now be
implemented.

Autocapitalisation is also moved, the IReceiver interface is simplified.
2022-11-13 16:28:39 +01:00
Jules Aguillon
f56b926857 Autocapitalisation: Avoid trigerring when Ctrl+Del
Autocapitalisation could trigger while repeatedly typing Ctrl+Del to
remove several words.
2022-10-16 22:34:21 +02:00
Jules Aguillon
d9a8688237 Fix crash due to auto capitalisation
It is unclear how _autocap.started is not called first but nothing is
preventing to initialize things earlier.
2022-10-15 16:19:27 +02:00
Jules Aguillon
3081af5190 Improve the auto capitalisation
- Detect when the input box is cleared
- Avoid looking up keys on the keyboard every time the shift state needs
  to change.
2022-09-24 22:36:06 +02:00
Jules Aguillon
c778b4e8a2 Fix autocapitalisation randomly not triggered
The autocapitalisation is asking the editor about whether to enable
shift and must make sure to ask after the editor is done processing the
events.
2022-09-24 18:53:37 +02:00
Jules Aguillon
85d798299e Standard auto-capitalisation only after space
Change the capitalisation algorithm to use Android's
'getCursorCapsMode'. This requires a bit of cursor calculations but
should feel more standard.

The auto completion only triggers after a space is typed or backspace is
pressed.
2022-07-30 17:56:31 +02:00
Jules Aguillon
081e9a6e53 Add an option to control auto capitalisation 2022-07-24 23:44:37 +02:00
Jules Aguillon
bfde31da6e Avoid automatic capitalisation when using arrows
Disable capitalisation just after an arrow kind is pressed to avoid
interrupting navigation.
2022-07-24 23:32:14 +02:00
Jules Aguillon
324756535e Automatic capitalisation at beginning of sentences
Keep track of end-of-sentence characters while typing and automatically
enable shift when appropriate.

The last few characters just before the cursor need to be queried in
some cases: Begin of input, cursor has moved or text is deleted.
This might have a performance cost.

This normally only enable shift but it also needs to disable shift when
the cursor moves.
2022-07-24 20:02:48 +02:00