Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

SaschaCowley
Copy link
Member

@SaschaCowley SaschaCowley commented Aug 30, 2024

Reverts PR

Reverts #16568

Issues fixed

Partial fix for #17027

Issues reopened

Reopens #9376

Reason for revert

The changes introduced a bug whereby if the final line was not blank, it would be read in place of the second-last line.

Can this PR be reimplemented? If so, what is required for the next attempt

The changes introduced are desirable if the case of erroneously reporting the last line instead of the second-last line can be resolved.

Summary by CodeRabbit

  • New Features
    • Improved NVDA screen reader accuracy for reading the last line of text in Java applications when the cursor is on the second-last line.
  • Bug Fixes
    • Enhanced control flow for determining line offsets, potentially improving performance and clarity in text reading.

@SaschaCowley SaschaCowley requested a review from a team as a code owner August 30, 2024 02:43
@SaschaCowley SaschaCowley requested a review from seanbudd August 30, 2024 02:43
Copy link
Contributor

coderabbitai bot commented Aug 30, 2024

Walkthrough

The changes include modifications to the NVDA screen reader's behavior in Java applications, specifically addressing an issue where it incorrectly read the last line of text when the cursor was on the second-last line in multiline edit controls. The control flow for determining line offsets was simplified to enhance accuracy in reading text content.

Changes

Files Change Summary
source/NVDAObjects/JAB/__init__.py Simplified the _getLineOffsets method to always retrieve line bounds for the character before the specified offset.
user_docs/en/changes.md Documented the new feature that corrects NVDA's reading behavior in Java applications, ensuring accurate line reading.

Assessment against linked issues

Objective Addressed Explanation
NVDA should read the content of the line where the cursor is positioned (i.e., the second last line). (#17027)

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4cd1ae0 and d312a7b.

Files selected for processing (2)
  • source/NVDAObjects/JAB/init.py (1 hunks)
  • user_docs/en/changes.md (1 hunks)
Additional context used
Path-based instructions (2)
source/NVDAObjects/JAB/__init__.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

user_docs/en/changes.md (3)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.md: Focus on grammar, spelling, and punctuation. Also consider readability and clarity of contents. Ensure that changes follow the style of one sentence per line, suggest changes if this is not met.


Pattern user_docs/en/changes.md: Ensure each change log entry references an issue or pull request number. Change log entries can also include a reference to a GitHub author. Examples of valid change log entries: * Item with sub-items (#123, @username): * sub-item * bar (#342) * Item with. Multiple lines. (#143)

Additional comments not posted (2)
source/NVDAObjects/JAB/__init__.py (1)

187-188: LGTM! But verify the function usage in the codebase.

The new implementation simplifies the logic and ensures that the line bounds are always fetched for the character before the specified offset. This change may improve performance and clarity.

The code changes are approved.

Run the following script to verify the function usage:

user_docs/en/changes.md (1)

64-64: LGTM!

The changelog entry is correctly formatted and references the relevant issue number.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@seanbudd
Copy link
Member

does this fix #17027? I think the issue should be kept open right?

@seanbudd seanbudd added this to the 2024.4 milestone Aug 30, 2024
@cary-rowen
Copy link
Contributor

See comment
Does this mean #16568 should not be reverted?

@SaschaCowley
Copy link
Member Author

I don't think it will fix it, but I think it will get rid of the annoying behaviour. I will ask the reporters to test the try build to confirm. I have edited the PR description to note that it will likely not fix the underlying issue.

@seanbudd seanbudd merged commit 4d1a43c into beta Aug 30, 2024
6 checks passed
@seanbudd seanbudd deleted the try-i17027 branch August 30, 2024 05:11
@XLTechie
Copy link
Collaborator

XLTechie commented Aug 30, 2024 via email

@seanbudd
Copy link
Member

Sorry I meant to do that manually, thanks for the reminder

@dmitrii-drobotov
Copy link
Contributor

@SaschaCowley from my own testing and understanding of the issue, I don't think the revert will improve the situation. The issue depends on whether the last line of a text is empty, and the behavior is the following:
In 2024.3: if the last line is not empty, there is a bug #17027. If the last line is empty, no issues.
In 2024.2 or after this revert: if the last line is not empty, there is still a bug #17027. If the last line is empty, there is a bug #9376.
So I'm not sure if the revert makes sense. @aaryan-kumar please correct me if I'm wrong.

@aaryan-kumar
Copy link

Hello @dmitrii-drobotov !
Let me clarify what NVDA should ideally do:

  1. Process the JTextArea and its content.
  2. Handle the JTextArea and its content similarly to how it's managed in Notepad.
  3. If the last line is empty, NVDA should announce "blank."
  4. If the second last line has content, NVDA should speak that content.
  5. If the last line has content, NVDA should speak the content of the last line.
  6. If both lines have content or if the second last line is empty, NVDA should detect and speak the text accordingly.
    If you need further explanation, I would be happy to provide a video demonstration.
    Thanks!

@dmitrii-drobotov
Copy link
Contributor

@aaryan-kumar yes, I understand the expected behavior, I was just trying to clarify the actual behavior in different NVDA versions.
Nevertheless, I will try to fix both of these bugs and also will make sure that there won't be a regression for #1892, which is another edge case in Java text areas.

@Adriani90
Copy link
Collaborator

@dmitrii-drobotov do you still plan to fix the coresponding bugs and to re submit the PR that was reverted here?

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.

7 participants