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

Disable caret at end of line detection in Chromium #17067

Merged
merged 1 commit into from
Aug 28, 2024
Merged

Disable caret at end of line detection in Chromium #17067

merged 1 commit into from
Aug 28, 2024

Conversation

michaelDCurran
Copy link
Member

@michaelDCurran michaelDCurran commented Aug 27, 2024

Link to issue number:

More broadly fixes #17039

Summary of the issue:

In PR #16745, code was added to detect the caret at end of lines in Mozilla-compatible edit areas, so as to not report the next line when on the final insertion point of the line before.
Although this works great in Firefox and other Gecko-based apps, it does not work at all in Chromium due to Chromium not correctly
implementing IAccessibleText::textAtOffset with IA2_OFFSET_CARET.
More importantly, this is a very costly check in VS code, which has a noticeable performance hit when arrowing up and down large files (issue #17039), for no gain.
PR #17051 successfully fixed the performance hit in VS code by disabling caret at end of line detection just for VS Code. But it was pointed out that there are several VS Code variants including VS Code.dev which require this also.

Description of user facing changes

NVDA is no longer as sluggish when arrowing up and down large fles in VS code and otherChromium-based applications.

Description of development approach

Testing strategy:

Retested steps in #17039, ensuring that the performance hit is stll gone in VS Code.

Known issues with pull request:

None known.

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.

Summary by CodeRabbit

  • New Features

    • Introduced enhanced accessibility features for text areas in Chromium-based applications.
    • Added support for better text editing capabilities with new Editor and EditorTextInfo classes.
  • Bug Fixes

    • Removed unnecessary caret detection methods to improve performance and accuracy in Chromium and VSCode environments.
  • Refactor

    • Streamlined code by eliminating outdated classes and methods associated with text handling in Visual Studio Code.

… yet implement what we need, and it is costly for no gain.
@michaelDCurran michaelDCurran requested a review from a team as a code owner August 27, 2024 21:57
Copy link
Contributor

coderabbitai bot commented Aug 27, 2024

Walkthrough

The changes introduce new classes for handling text areas in Chromium-based applications and remove redundant classes related to text handling in Visual Studio Code. The EditorTextInfo and Editor classes enhance accessibility features, while the removal of VSCodeEditor and VSCodeEditorTextInfo simplifies the codebase, addressing performance issues noted in the linked issue.

Changes

Files Change Summary
source/NVDAObjects/IAccessible/chromium.py Added EditorTextInfo and Editor classes to improve text area handling; modified findExtraOverlayClasses to prioritize Editor.
source/appModules/code.py Removed VSCodeEditorTextInfo and VSCodeEditor classes; updated VSCodeDocument to remove assignment of textInfo.

Assessment against linked issues

Objective Addressed Explanation
NVDA responsiveness in VS Code editors (Issue #17039)
Remove unnecessary classes and methods for performance

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 69b9ce4 and 5373ae4.

Files selected for processing (2)
  • source/NVDAObjects/IAccessible/chromium.py (2 hunks)
  • source/appModules/code.py (1 hunks)
Files skipped from review due to trivial changes (1)
  • source/appModules/code.py
Additional context used
Path-based instructions (1)
source/NVDAObjects/IAccessible/chromium.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.

Additional comments not posted (3)
source/NVDAObjects/IAccessible/chromium.py (3)

169-179: LGTM!

The method _isCaretAtEndOfLine is correctly implemented to address performance issues in Chromium. The comments provide a clear explanation of the rationale.

The code changes are approved.


182-185: LGTM!

The class Editor correctly sets TextInfo to EditorTextInfo, ensuring that the performance improvements are applied.

The code changes are approved.


210-211: LGTM!

The modification ensures that the Editor class is prioritized, which is necessary for the performance improvements to take effect.

The code changes are approved.


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

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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 seanbudd merged commit 992453c into beta Aug 28, 2024
2 checks passed
@seanbudd seanbudd deleted the i17039-2 branch August 28, 2024 04:05
@github-actions github-actions bot added this to the 2025.1 milestone Aug 28, 2024
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.

2 participants