Skip to content

Fix-up of #14557: remove unwanted backslashes appearing in replacement expression of dictionary#14664

Merged
seanbudd merged 1 commit into
nvaccess:masterfrom
CyrilleB79:fixup14557
Feb 22, 2023
Merged

Fix-up of #14557: remove unwanted backslashes appearing in replacement expression of dictionary#14664
seanbudd merged 1 commit into
nvaccess:masterfrom
CyrilleB79:fixup14557

Conversation

@CyrilleB79

@CyrilleB79 CyrilleB79 commented Feb 22, 2023

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #14663
Fix-up of #14557

Summary of the issue:

When reading text containing a non-regexp dictionary entry, if the replacement field contains some special characters (such as space, +, etc.), these characters are escaped with a backslash. Thus this backslash is heard in the text spoken by NVDA.

Description of user facing changes

No unappropriated backslash will be spoken by NVDA when the replacement field of a dictionary entry contains space or other special character.

Description of development approach

Use theString.replace('\\', '\\\\') instead of re.escape(theString).

Indeed, it was well documented in the doc of re.escape:

This function must not be used for the replacement string in sub() and subn(), only backslashes should be escaped.

Testing strategy:

Manual tests:

Known issues with pull request:

None

Change log entries:

None: fixing unreleased bug.

Code Review Checklist:

  • Pull Request description:
    • description is up to date
    • change log entries
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • API is compatible with existing add-ons.
  • Documentation:
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • Security precautions taken.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 80cd36cb19

@CyrilleB79 CyrilleB79 marked this pull request as ready for review February 22, 2023 16:37
@CyrilleB79 CyrilleB79 requested a review from a team as a code owner February 22, 2023 16:37
@CyrilleB79 CyrilleB79 requested a review from seanbudd February 22, 2023 16:37
@CyrilleB79

Copy link
Copy Markdown
Contributor Author

System test failure is unrelated.

@seanbudd seanbudd merged commit 96504fb into nvaccess:master Feb 22, 2023
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Feb 22, 2023
@CyrilleB79 CyrilleB79 deleted the fixup14557 branch February 24, 2023 16:26
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.

Strange behavior in dictionaries if replacement contains space

4 participants