Skip to content

Add commands to move the review cursor to the first and last character of selected text#17393

Merged
SaschaCowley merged 8 commits into
nvaccess:masterfrom
nvdaes:reviewSelection
Nov 21, 2024
Merged

Add commands to move the review cursor to the first and last character of selected text#17393
SaschaCowley merged 8 commits into
nvaccess:masterfrom
nvdaes:reviewSelection

Conversation

@nvdaes

@nvdaes nvdaes commented Nov 11, 2024

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #17299

Summary of the issue:

NVDA doesn't have commands to move the review cursor to start and end of selection, which may be useful to review the selected text.

Description of user facing changes

NVDA+alt+home and NVDA+alt+end can be used to move the review cursor to the first and last carácter of selected text.

Description of development approach

In globalCommands.py, GlobalCommands class, a staticmethod has been added to get the current selection. This is used to scripts added to move the review cursor to start and end of selection, similar to other scripts used to move the review cursor.

Testing strategy:

Tested manually in a webpage and in Notepad.

Known issues with pull request:

None.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@burmancomp

Copy link
Copy Markdown
Contributor

Thank you! It works most of time but could you investigate situation in ms word when uia is used only when necessary. In windows 11 23h2 and word 2019 I got runtime error.

You could try with text like:

"line 1
line 2
line 3
line 4"

Note that no new line after number 4. Then try to select lines line 3 and line 4 so that you are in the start of line 3, and then press twice shift+down arrow. Then use nvda+alt+home, and try nvda+alt+end. I got following:

Input: kb(laptop):NVDA+alt+end
ERROR - scriptHandler.executeScript (13:36:45.912) - MainThread (6848):
error executing script: <bound method GlobalCommands.script_review_endOfSelection of <globalCommands.GlobalCommands object at 0x0A4AFA10>> with gesture 'NVDA+alt+end'
Traceback (most recent call last):
File "scriptHandler.pyc", line 300, in executeScript
File "globalCommands.pyc", line 2251, in script_review_endOfSelection
File "NVDAObjects\window\winword.pyc", line 1226, in collapse
RuntimeError

@nvdaes

nvdaes commented Nov 12, 2024

Copy link
Copy Markdown
Collaborator Author

@burmancomp , please, feel free to test again in MS Word with UIA enabled only when needed or with other configurations and applications. I think that now this is fixed, according to my tests. Now we move the end of the selection info one character back before collapsing, instead of collapsing and then moving back one character.

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Nov 12, 2024
@burmancomp

Copy link
Copy Markdown
Contributor

Works for me, thank you!

@nvdaes

nvdaes commented Nov 13, 2024

Copy link
Copy Markdown
Collaborator Author

Then let's mark this as ready for review.

@nvdaes nvdaes marked this pull request as ready for review November 13, 2024 09:57
@nvdaes nvdaes requested review from a team as code owners November 13, 2024 09:57

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nvdaes. Mostly cosmetic changes requested, but I think you have accidentally deleted the move to end of line in review gesture.

Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py
Comment thread source/globalCommands.py Outdated
Comment thread source/globalCommands.py Outdated
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/userGuide.md Outdated
@nvdaes

nvdaes commented Nov 19, 2024

Copy link
Copy Markdown
Collaborator Author

@SaschaCowley , think that all your suggestions are addressed now.
Thanks for your review, and thanks all reviewers.

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @nvdaes

@SaschaCowley SaschaCowley merged commit c32e0e7 into nvaccess:master Nov 21, 2024
@github-actions github-actions Bot added this to the 2025.1 milestone Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gesture to move to start/end of selection in documents and edit controls

4 participants