Skip to content

Fix reading the last empty line of a text in apps using Java Access Bridge#16568

Merged
seanbudd merged 1 commit into
nvaccess:masterfrom
dmitrii-drobotov:9376-Fix-JAB-last-line-duplicate-announcement
May 20, 2024
Merged

Fix reading the last empty line of a text in apps using Java Access Bridge#16568
seanbudd merged 1 commit into
nvaccess:masterfrom
dmitrii-drobotov:9376-Fix-JAB-last-line-duplicate-announcement

Conversation

@dmitrii-drobotov

Copy link
Copy Markdown
Contributor

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:

1
2
3

Before changes

edit multi line 1
down arrow
2
down arrow
3
down arrow
3

After changes

edit multi line 1
down arrow
2
down arrow
3
down arrow
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.

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:

  • 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.

@dmitrii-drobotov dmitrii-drobotov requested a review from a team as a code owner May 17, 2024 15:42
@dmitrii-drobotov dmitrii-drobotov requested a review from seanbudd May 17, 2024 15:42
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 9755f4b32d

@dmitrii-drobotov dmitrii-drobotov force-pushed the 9376-Fix-JAB-last-line-duplicate-announcement branch from 50d01ae to 9477648 Compare May 17, 2024 16:22
@seanbudd seanbudd merged commit c333bef into nvaccess:master May 20, 2024
@seanbudd

Copy link
Copy Markdown
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nvda repeats the penultimate line of a text in a java application when the last line is empty

3 participants