Fix reading the last empty line of a text in apps using Java Access Bridge#16568
Merged
seanbudd merged 1 commit intoMay 20, 2024
Conversation
See test results for failed build of commit 9755f4b32d |
50d01ae to
9477648
Compare
seanbudd
approved these changes
May 20, 2024
Member
|
Thanks @dmitrii-drobotov ! |
seanbudd
pushed a commit
that referenced
this pull request
May 20, 2024
…ridge (#16568) Fixes #9376. Summary of the issue: In applications using Java Access Bridge, if the last line of a text is an empty line, then NVDA reads the previous line as the last line. Description of user facing changes NVDA will now correctly read the last empty line as "blank". Description of development approach The issue is related to fixes of #1892 in 7ef99c3, which work around the line bounds returned by JAB for the last character of a text. Specifically, the current behavior is to get the line bounds of the previous character, which works well for single-line text inputs. But if the text is multi-line, and we're on the last empty line, then getting the line bounds of the previous character results in repeating the penultimate line. The fix is to separately handle the case of empty last line, which is determined by having "\n" as the previous character.
This was referenced Aug 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
Fixes #9376.
Summary of the issue:
In applications using Java Access Bridge, if the last line of a text is an empty line, then NVDA reads the previous line as the last line.
Description of user facing changes
NVDA will now correctly read the last empty line as "blank".
For example, here is NVDA output (with Speak command keys turned on) for the following text in a Java Swing text area:
Before changes
After changes
Description of development approach
The issue is related to fixes of #1892 in 7ef99c3, which work around the line bounds returned by JAB for the last character of a text. Specifically, the current behavior is to get the line bounds of the previous character, which works well for single-line text inputs. But if the text is multi-line, and we're on the last empty line, then getting the line bounds of the previous character results in repeating the penultimate line.
The fix is to separately handle the case of empty last line, which is determined by having "\n" as the previous character.
Testing strategy:
Tested manually in a simple Swing app, and in IntelliJ-based IDEs (PyCharm, Android Studio, etc.). Also tested the case from #1892, which didn't regress.
Known issues with pull request:
None.
Code Review Checklist: