Fix Edit.makeTextInfo(caret) when selection is present #16455
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to issue number:
N/A - please let me know if you want me to create a proper issue first
Summary of the issue:
Suppose some text is selected in NVDA log viewer. Caret can be either at the beginning or at the end of selection, depending on whether we selected text back or forward. Now when calling
I observed that instead of actual caret position, it always returns the beginning of the selection, which is wrong.
Description of user facing changes
N/A as far as I can tell.
Description of development approach
This PR fixes bug in
NVDAObjects.window.edit.ITextDocumentTextInfo
class.I query
ITextSelection.Flags
and check whetehrtomSelStartActive
flag is set, and depending on that I collapse either to beginning or to the end depending where the curosr actually is located at the moment.Testing strategy:
Tested manually in NVDA log viewer. In order to figure out where caret resides I use the following snippet:
Known issues with pull request:
N/A
Notes
Just for the record if anyone is interested why I'm proposing this change. I am working on customized word selection script for WordNav add-on and one thing I need is to be able to determine whether caret is currently residing at the beginning or at the end of the selection. It would help if this issue is fixed in the core.
Code Review Checklist: