fix(windows): add text selected bool emit backspace key when text selected in TSF
Fixes: #7870 Add a bool to the KeymanGetContext call, allowing the Windows engine to make the decision to emit backspace keystroke when text is selected allowing the application to make the correct decision on how to handle it.
This change feels like it is half the solution the full solution would be to have a mechanism for allowing the Keyman Core to know if text has been selected. &hasSelection As discussed in issue #9703 as a Future solution.
With this change the core will request the character closest to the selection to be deleted its internal cache will match this, even though the engine will essentially overide this request and just emit the backspace keystroke. As it is TSF - context aware it will be updated on the next key stroke anyway with the correct context.
User Test Results
Test specification and instructions
- ✅ TEST_DELETE_SELECTED_TEXT (PASSED) (notes)
- ✅ TEST_BACKSPACE_NO_SELECTION (PASSED) (notes)
- ✅ TEST_SELECTION_TYPE_CHAR (PASSED) (notes)
Test Artifacts
When KeymanGetContext calls GetLeftofSelection add the cFetched, tfSelection and hr result as parameters so the the TSF API call GetSelection is just called once and the information will be available to IsKeymanIsTextSelected, no need for it to make that API call again. Make KeymanIsTextSelected a private function as it should not be called independently of KeymanGetContext.
Test Results
I tested this issue with the attached "keyman-18.0.61-alpha-test-11884" build on the Windows 10 & 11 OS environment: Here is my observation.
Prerequisite steps:
- Installed the "keyman-18.0.61.exe" file.
- Keyman keyboard added in the system tray.
- Open the keyman "Configuration" window.
- Add the "EuroLatin" keyboard by clicking the "Download keyboard" button.
- TEST_DELETE_SELECTED_TEXT (Passed):
- Followed the above prerequisite steps:
- Open the Wordpad.
- Type "mySchool" and select "School" by clicking the mouse.
- Type the "Backspace" key. Results: Here, It is showing the "my" word in the Wordpad.
- TEST_BACKSPACE_NO_SELECTION (Passed):
- Followed the above prerequisite steps:
- Open the Wordpad.
- Type "myschool" and then move the cursor to the right of "l"
- Type the "Backspace" key. Results: Here, It is showing the "mySchoo" word in the Wordpad.
- TEST_SELECTION_TYPE_CHAR (Passed):
- Followed the above prerequisite steps:
- Open the Wordpad.
- Type "mySchool" and select "School" by clicking the mouse.
- Type the "t" key. Results: Here, It is showing the "myt" word in the Wordpad. It is working as per the expected results. Thank you.
Changes in this pull request will be available for download in Keyman version 18.0.73-alpha
@rc-swag just following up on the concerns I noted post-merge