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

When spelling by line, ensure that only normalized characters report as such #17295

Merged
merged 5 commits into from
Oct 18, 2024

Conversation

LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR commented Oct 15, 2024

Link to issue number:

Fixes #17286

Summary of the issue:

When spelling by line, when NVDA normalizes a character, it would incorrectly report all following characters as normalized.

Description of user facing changes

The above issue is fixed.

Description of development approach

There was an isNormalized boolean that would report all characters as normalized when set to True. I fixed this by creating a variable local to the loop that contains the per character normalization state.

Testing strategy:

Tested str from

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 review

Summary by CodeRabbit

  • New Features

    • Support for new braille displays with automatic detection.
    • Enhanced support for Microsoft Office applications, improving formatting and navigation.
    • Major improvements in web browsing support, including faster rendering and ARIA landmark support.
    • Introduction of a new Add-ons Manager and configuration profiles.
    • Support for global plugins to extend NVDA's functionality.
  • Bug Fixes

    • Improved stability and performance with fixes for crashes and freezes.
  • Documentation

    • Updated comments and docstrings for clarity and consistency.

@LeonarddeR LeonarddeR requested a review from a team as a code owner October 15, 2024 09:06
@LeonarddeR
Copy link
Collaborator Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Oct 15, 2024

Walkthrough

The changes in this pull request primarily enhance the speech processing capabilities of the NVDA application. Key modifications include updates to the processText and speak functions for improved handling of text and speech sequences, along with refined logic in various speech-related functions. Additionally, there are parameter renamings for clarity, better error handling, and new features that provide nuanced speech output based on control context.

Changes

File Path Change Summary
source/speech/speech.py - Refined processText and speak functions for better text processing and speech sequence handling.
- Renamed isNormalized to textIsNormalized for clarity.
- Improved logic in getControlFieldSpeech and getIndentationSpeech.
- Enhanced error handling and state management across functions.
- Added checks in getPropertiesSpeech for context-based speech output.
user_docs/en/changes.md - Documented improvements in NVDA functionalities, including braille support, Microsoft Office enhancements, web browsing improvements, and user interface updates.
- Added method and variable changes in src/calculator.py.

Assessment against linked issues

Objective Addressed Explanation
Unicode normalization while spelling not working correctly (#17286)

Possibly related issues

Possibly related PRs

Suggested labels

conceptApproved

Suggested reviewers

  • Qchristensen
  • seanbudd
  • SaschaCowley

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
source/speech/speech.py (1)

Line range hint 421-499: Recommend Adding Unit Tests for Character Normalization

To ensure the correctness of the new normalization logic and prevent future regressions, consider adding unit tests that cover edge cases where characters are normalized individually during spelling.

Would you like assistance in generating these unit tests or opening a new GitHub issue to track this task?

📜 Review details

Configuration used: .coderabbit.yml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between e01caee and 856ce68.

📒 Files selected for processing (2)
  • source/speech/speech.py (4 hunks)
  • user_docs/en/changes.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
source/speech/speech.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 (6)
user_docs/en/changes.md (5)

Line range hint 3-7: Overview of NVDA 2025.1 release

This release introduces several new features and improvements, including enhanced support for Microsoft Office applications, new braille functionality, and various bug fixes. It also includes some important changes for developers.


Line range hint 9-15: Notable new features

  • Support for charts in Microsoft Word and PowerPoint
  • Automatic reporting of new text output in various applications
  • New braille translation tables and improved braille input support
  • Experimental support for Google Sheets with Braille mode

Line range hint 17-24: Significant changes and improvements

  • Updated components: liblouis braille translator, eSpeak-NG, Unicode CLDR
  • Improvements to Microsoft Office support, including Excel and Word
  • Enhanced support for braille displays

Line range hint 26-34: Major bug fixes

  • Fixes for Microsoft Word, Excel, and PowerPoint
  • Improvements to web browsing in Firefox and Chrome
  • Various fixes for braille display support

Line range hint 36-46: Important changes for developers

  • New extension points added
  • Changes to speech functions and SSML support
  • Updates to the NVDA Controller Client library
  • Deprecations and removals of various APIs

Developers should review these changes carefully to ensure compatibility with their add-ons and integrations.

source/speech/speech.py (1)

Line range hint 457-499: Logic Update Correctly Handles Character Normalization Individually

The introduction of textIsNormalized and itemIsNormalized within the loop ensures that each character's normalization state is handled independently. This effectively fixes the issue where a normalized character caused all subsequent characters to be incorrectly reported as normalized.

source/speech/speech.py Show resolved Hide resolved
@CyrilleB79
Copy link
Collaborator

Thanks for fixing this @LeonarddeR.

I have another case where normalization does not work as expected:

  • look at the following line:
    aéb
  • Spell it with NVDA+upArrow twice
  • Then navigate character by character with arrows

When the whole line is spelled, "normalized" is not reported; but when I navigate with arrows (left/right), it is. This inconsistency is confusing. I'd expect "Normalized" to be also reported when the line is being spelled.

Can you fix this in the same PR or should I open a new issue?

user_docs/en/changes.md Outdated Show resolved Hide resolved
LeonarddeR and others added 3 commits October 17, 2024 19:36
Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
@SaschaCowley SaschaCowley merged commit bfd91ac into nvaccess:master Oct 18, 2024
5 checks passed
@github-actions github-actions bot added this to the 2025.1 milestone Oct 18, 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.

Unicode normalization while spelling not working correctly
3 participants