Skip to content

Add ability to report start of paragraphs in braille#16906

Merged
seanbudd merged 52 commits into
nvaccess:masterfrom
nvdaes:brailleParagraphs
Aug 2, 2024
Merged

Add ability to report start of paragraphs in braille#16906
seanbudd merged 52 commits into
nvaccess:masterfrom
nvdaes:brailleParagraphs

Conversation

@nvdaes

@nvdaes nvdaes commented Jul 24, 2024

Copy link
Copy Markdown
Collaborator

Link to issue number:

Closes #16895

Summary of the issue:

NVDA should have an option to indicate paragraphs in braille, so that reading, especially books or long pieces of text, can be more comfortable and meaningful.

Description of user facing changes

  • In the braille settings panel, a new combo box can be used for setting NVDA to show two spaces, a pilcrow or no marker at the start of paragraphs in braille. This requires that the reading by paragraph checkbox is enabled.

Description of development approach

  • A new option for this feature has been added in the braille section of config.conf.
  • In config["braille"], a string is assigned to get the startParagraphMarker.
  • A getParagraphStartMarker function has been added, so that it can be used in different places of braille.py, and in this way we can also make the PILCROW translatable.
  • In the getFormatFieldBraille function of braille.py: when the isAtStart parameter is True, NVDA will check if it's configured to read by paragraph and if it should present the start paragraph indicator, through the getParagraphStartMarker function.
  • In the _set_windowEndPos function of braille.py: if the braille wrap word and paragraph start options are enabled, and the start window pos to be set is minor than or equal to the lenghts of paragraph start indicator + 1 (1 corresponding to the text separator), tart pos is set to the start position of the last region if it starts with paragraph start indicator plus text separator. This handles some cases where the paragraph start indicator is not displayed when the braille word wrap is enabled.
  • The braille settings subpanel has been updated in the gui.
  • A new ParagraphStartMarker class has been added to configFlags.py

Testing strategy:

Tested manually:

  • Reading scrolling foreard and backward, and moving forward and backward through paragraphs, the braille display.
  • Moving backward and forward between paragraph with right and left arrows, and control+down and control + up arrow.
  • Checking the start position to handle cases where the paragraph start indicator wasn't displayed in braille.
  • Tested options added in the braille settings panel.

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.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced a configuration option to indicate the start of paragraphs in braille for improved accessibility.
    • Added a feature in the Braille settings panel that allows users to toggle the visibility of paragraph starts.
  • Documentation

    • Updated user guide to include information on the new Braille settings related to paragraph starts.
    • Enhanced user documentation to reflect the impact of paragraph indicators on reading experience and navigation.
  • Bug Fixes

    • Improved logic in braille formatting to better reflect user preferences based on updated configuration settings.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 062c99a010

@nvdaes

nvdaes commented Jul 25, 2024

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 25, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The recent changes introduce a feature in NVDA that allows users to indicate the start of paragraphs in braille when the "reading by paragraph" option is enabled. This functionality enhances accessibility by providing clearer context, making it easier for users who rely on braille output to understand textual structures.

Changes

Files Change Summary
source/braille.py, source/config/configSpec.py, source/gui/settingsDialogs.py Added a new constant PARAGRAPH_START for paragraph indicators, introduced a configuration flag showParagraphStart, and enhanced the Braille settings panel to allow users to enable or disable this feature.
user_docs/en/changes.md, user_docs/en/userGuide.md Updated documentation to reflect the new paragraph display feature in braille settings, improving user guidance and experience.

Assessment against linked issues

Objective Addressed Explanation
Add option to display paragraph indicators in braille (16895)

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
user_docs/en/userGuide.md (1)

2166-2169: Ensure clarity and consistency.

The new section introducing the option to show paragraph starts in Braille settings is clear and concise. However, consider rephrasing for better readability and consistency with the rest of the document.

- If enabled and read by paragraph is checked, two spaces will be displayed to indicate paragraph start.
+ If enabled and "Read by paragraph" is checked, two spaces will be displayed to indicate the start of a paragraph.

@nvdaes nvdaes marked this pull request as ready for review July 25, 2024 06:51
@nvdaes nvdaes requested review from a team as code owners July 25, 2024 06:51
Comment thread user_docs/en/changes.md Outdated
Comment thread user_docs/en/userGuide.md Outdated
Comment thread source/gui/settingsDialogs.py Outdated
Comment thread user_docs/en/userGuide.md
Comment thread user_docs/en/userGuide.md Outdated

##### Show paragraphs start {#BrailleSettingsShowParagraphStart}

- If enabled and "Read by paragraph" is checked, two spaces will be displayed to indicate the start of a paragraph.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • remove leading dash
  • Link the "Read by paragraph" option
Suggested change
- If enabled and "Read by paragraph" is checked, two spaces will be displayed to indicate the start of a paragraph.
If enabled and "[Read by paragraph](#BrailleSettingsReadByParagraph)" is checked, two spaces will be displayed to indicate the start of a paragraph.

Moreover, it would be worth rephrasing this paragraph with a bit more details. But I am not familiar with "Read by paragraph" option and will not be able to test on a braille display before next week, so I won't be able to make a detailed suggestion.

Maybe something like the following (to be adapted and polished):
When "Read by paragraph" option is enabled, we face [issueToBeDescribed, e.g. difficulty to identify paragraph start].
Enabling this option enable to mitigate this issue adding two spaces at the beginning of paragraphs.

@nvdaes

nvdaes commented Jul 25, 2024

Copy link
Copy Markdown
Collaborator Author

@CyrilleB79 , thanks for your review. I think I've addressed all your suggestions. Let me know if I should apply any other changes.

Comment thread user_docs/en/userGuide.md Outdated
Comment thread user_docs/en/userGuide.md Outdated
Co-authored-by: Luke Davis <8139760+XLTechie@users.noreply.github.com>
@nvdaes

nvdaes commented Jul 25, 2024

Copy link
Copy Markdown
Collaborator Author

@XLTechie , thanks for your review. I've applied your suggestions. Let me know if I should fix other things.

@nvdaes

nvdaes commented Jul 27, 2024

Copy link
Copy Markdown
Collaborator Author

These days I'm testing this in my daily reading. I've observed that, once, when scrolling down the braille display, two spaces haven't been shown at the start of the paragrahp and I needed to scroll up and down. This may be related to a separate issue, since sometimes the first character is not shown and scrolling up and down is needed. I thought that trying to set two spaces as the paragraph start indicator may fix this issue, but it doesn't work.
Seems its related to word wraping, so I'll mark this PR as a draft and I'll try to work on this.

@nvdaes nvdaes marked this pull request as draft July 27, 2024 01:31
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 754c785426

Co-authored-by: Sean Budd <seanbudd123@gmail.com>
Comment thread source/config/configFlags.py Outdated
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 535ff1f155

nvdaes and others added 2 commits August 1, 2024 08:44
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
@nvdaes

nvdaes commented Aug 1, 2024

Copy link
Copy Markdown
Collaborator Author

@seanbudd , many thanks for explaining the reason to make the option about paragraph markers an integer. I didn't realise that s.making pilcrows translatable makes this necessary.
I'll finish and test this properly today, in a few hours.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit bcbbfd3fe1

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 9c870b2bc4

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit ee5eb7a416

@nvdaes nvdaes marked this pull request as ready for review August 1, 2024 20:32
@nvdaes

nvdaes commented Aug 1, 2024

Copy link
Copy Markdown
Collaborator Author

@seanbudd , seems that we can not assign a value to PILCROW in the enum class using pgettext or _(). So I've created a new function in braille.py to get the text corresponding to the paragraphStartMarker, and from this functon this can be made translatable.

Comment thread source/config/configFlags.py Outdated
Comment on lines +259 to +266
# Translators: This is a paragraph start marker used in braille.
# The default symbol is the pilcrow,
# a symbol also known as "paragraph symbol" or "paragraph marker".
# This symbol should translate in braille via LibLouis automatically.
# If there is a more appropriate character for your locale,
# consider overwriting this (e.g. for Ge'ez ፨).
# You can also use Unicode Braille such as ⠘⠏.
# Ensure this is consistent with other strings with the context "paragraphMarker".

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this comment should be deleted now that it has been moved to getParagraphStartMarker

Comment thread source/config/configSpec.py Outdated
optionsEnum="ReviewRoutingMovesSystemCaretFlag", behaviorOfDefault="NEVER")
readByParagraph = boolean(default=false)
paragraphStartMarker = option("", " ", "¶", default="")
paragraphStartMarker = integer(min=0, max=2, default=0)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this change is no longer necessary if the pilcrow is not translatable

Comment thread source/braille.py Outdated
@seanbudd seanbudd marked this pull request as draft August 2, 2024 00:31
@nvdaes

nvdaes commented Aug 2, 2024

Copy link
Copy Markdown
Collaborator Author

pre-commit.ci run

@nvdaes nvdaes marked this pull request as ready for review August 2, 2024 04:25
@nvdaes

nvdaes commented Aug 2, 2024

Copy link
Copy Markdown
Collaborator Author

@seanbudd , I've addressed your comments. Please let me know if anything else needs to be done.

@seanbudd seanbudd merged commit fbb7437 into nvaccess:master Aug 2, 2024
@nvdaes nvdaes deleted the brailleParagraphs branch August 2, 2024 05:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to display paragraph indicators in braille

6 participants