Open rc-swag opened 1 year ago
See the Google doc for a test matrix for the different platforms.
(Selection and insertion pointer marked with ⁞
throughout this document)
Run the following tests with a keyboard that has the rule '^' + [K_A] > 'Â'
, e.g. _text_selection_testskeyboard or _sil_eurolatin:
^⁞X the quick brown fox⁞A
in doc. Typing BKSP.
Expected result: ^⁞A
^⁞X the quick brown fox⁞
in doc. Typing BKSP, then Shift+A.
Expected result: Â⁞
⁞^⁞
in doc, selection as indicated, typing Shift+A.
Expected result: A⁞
^⁞X⁞
in doc. Typing Shift+A.
Expected result: Â⁞
^⁞X the quick brown fox⁞
in doc. Typing Shift+A.
Expected result: Â⁞
Run the following tests with a keyboard that has the rule '^' + [K_BKSP] > 'foo'
, e.g. _text_selection_testskeyboard:
^⁞X⁞
in doc. Typing BKSP.
Expected result: ^⁞
^⁞X⁞
in doc. Typing BKSP, BKSP.
Expected result: foo⁞
The following tests can be run with any keyboard, e.g. _text_selection_testskeyboard:
^⁞X⁞
in doc. Pressing and releasing SHIFT key.
Expected result: ^⁞X⁞
(no change). On Touch keyboard switch to Shift
layer. (cf #7866)a⁞bc de⁞
in doc with selection starting at b
. Typing BKSP.
Expected result: a⁞
. (cf #8827)a⁞bc de⁞
in doc with selection starting at e
. Typing BKSP.
Expected result: a⁞
. (cf #8827)abc ⁞de⁞ fg
in doc. Typing BKSP.
Expected result: abc ⁞ fg
. (cf #7865)a→⁞
in doc (i.e. A followed by TAB. With _text_selection_testskeyboard you can press T to get the TAB character.).
Typing BKSP.
Expected result: a⁞
. (cf #9970)abc⁞
in doc. Typing BKSP.
Expected result: ab⁞
(cf #9971)Run the following tests with the _text_selection_testskeyboard:
[K_BKQUOTE]
and B and C.
Press BKSP twice.
Expected result: ok1
[K_BKQUOTE]
and B. Select B (Xa⁞b⁞
).
Press BKSP twice.
Expected result: X⁞
[K_BKQUOTE]
and B. Select B (Xa⁞b⁞
).
Press BKSP then O.
Expected result: Xao⁞
(Desktop only) Run the following test with the EMUFI keyboard and Ge'ez Manuscript Zemen font (You might have to save the result as UTF-16 and then inspect in a hex editor, if the current editor doesn't show the correct font):
Run these tests with a keyboard with start-of-sentence rules, e.g. English - EuroLatin (SIL)
.
Hello ⁞world⁞
in doc.
Expected result: Shift layer should NOT be active (cf #7168)Hello. ⁞world⁞
in doc.
Expected result: Shift layer should be active (cf #7168)Hello. ⁞world⁞
in doc. Typing BKSP.
Expected result: Hello. ⁞
, shift layer should be activeHello. ⁞world⁞
in doc. Pressing A key.
Expected result: Hello. A⁞
, default layer activeWith English - EuroLatin (SIL)
keyboard:
Hello ⁞world⁞
in doc.
Expected results: lowercase predictions (cf #7168)Hello. ⁞world⁞
in doc.
Expected results: uppercase predictions (cf #7168)Hello ⁞world⁞
in doc. Pick one prediction, e.g. and
.
Expected results: Hello and⁞
Hello. ⁞world⁞
in doc. Pick one prediction, e.g. The
.
Expected results: Hello. The⁞
⁞Hello⁞. world
in doc. Pick one prediction, e.g. The
.
Expected results: The⁞. world
(cf #7163)Windows | Linux | |
---|---|---|
TSF/surrouning-text | Wordpad, Word, Firefox | gedit, LibreOffice, Firefox |
legacy | LibreOffice, Chrome | Chrome, gnome-terminal |
A suitable page for testing in a browser is https://onlinenotepad.org/notepad.
The _text_selection_testskeyboard test keyboard is available in the artifacts of the last successful Keyman Developer test build, as keyboards/text_selection_tests_keyboard_9073/build/text_selection_tests_keyboard_9073.kmp
(or here:
text_selection_tests_keyboard.zip).
A test page for Web/Android/iOS is in the static
folder on downloads.keyman.com
Text Selection, Key processing and Keyman Core
Note:
⁞
here is used to delineate text selection throughout this spec:⁞
indicates the text caret without a selection; or⁞
is selected.For 'legacy' apps, where we do not have data about text selection or context prior to the selected text, none of this information applies. This information is only about 'modern' apps which supply context (e.g. on Windows, TSF-aware apps).
Related issues
Related pull requests
PR#5854fix(web): Allow touch-alias elements to clear text selectionPR#5922fix(android/engine): Don't pass selected text to KeymanWebIntroduction
When a user selects text then presses a key; either a Backspace or a Character Key we need to define the expect result. Looking at a variety of scenarios and the current related issues makes it clear that we could:
This specification will describe the way Keyman handles processing when a section of text is selected and then a key is pressed. Followed by some example scenarios.
Specification
newcontext
because a text-changing event has occurred which is outside the engines control. (as the backspace will be passed to the app so it can delete text as required, e.g. a selection across multiple fields or a multi-selection)Applied Examples
How do we treat context when we have a selection?
⁞^⁞
in doc, selection as indicated.Typing A result:
A⁞
.^⁞X⁞
in doc.Typing A result:
Â⁞
^⁞X the quick brown fox⁞
in doc.Typing A give us
Â⁞
^⁞X the quick brown fox⁞
in doc.Typing Backspace, then A, result:
Â⁞
^⁞X the quick brown fox⁞A
in doc.Typing Backspace give us
^⁞A
Additional questions and answers
What shift state should we give the keyboard on touch keyboards when we have a selection?
Hello. ⁞world⁞
, note that 'world' is lower-case, but a sentence-aware keyboard would expect to start a new sentence due to the full stop prior. So, with a selection, should the touch keyboard go to shift layer to match 'start of sentence'?begin newcontext
, and be given the contextHello.
Thus, a sentence-aware keyboard would set the touch keyboard to the Shift layer.What should Backspace do when there is a selection?
Future solution not covered by this specification --
&hasSelection
Suggestion for the future: add a
&hasSelection
system store. And&intent
(text,number,etc) would be nice to throw in.Until we implement
&hasSelection
, the answer is to apply keyboard rules (thus, the Example 2 above), except for Backspace, which behaves the same as Delete.Adding the
&hasSelection
flag allows keyboard authors to override the default, and will allow them to process Backspace or Delete when there is a selection, and provide a sensible result. This will require updating the keyboard&version
tovX.Y
(the version where we introduce this feature).We will need to work through the edge cases carefully here when we implement this.
Reference