-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spec: Text Selection and Key Processing #9073
Comments
Text Selection TestsSee the Google doc for a test matrix for the different platforms. (Selection and insertion pointer marked with General test scenariosRun the following tests with a keyboard that has the rule
Run the following tests with a keyboard that has the rule
The following tests can be run with any keyboard, e.g. text_selection_tests_keyboard:
Run the following tests with the text_selection_tests_keyboard:
(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):
Start-of-sentence testsRun these tests with a keyboard with start-of-sentence rules, e.g.
Predictive text testsWith
Suitable apps for testing
A suitable page for testing in a browser is https://onlinenotepad.org/notepad. text_selection_tests_keyboard test keyboardThe text_selection_tests_keyboard test keyboard is available in the artifacts of the last successful Keyman Developer test build, as A test page for Web/Android/iOS is in the |
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?
Example:
⁞^⁞
in doc, selection as indicated.Typing A result:
A⁞
.Example:
^⁞X⁞
in doc.Typing A result:
Â⁞
Example:
^⁞X the quick brown fox⁞
in doc.Typing A give us
Â⁞
Example:
^⁞X the quick brown fox⁞
in doc.Typing Backspace, then A, result:
Â⁞
Example:
^⁞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
The text was updated successfully, but these errors were encountered: