Skip to content

Commit

Permalink
Fix braille next line command for documents of Notepad++ (#17431)
Browse files Browse the repository at this point in the history
Fixes #17430

Summary of the issue:
Next braille line command doesn't work in Notepad++ documents when the last line is empty.

Description of user facing changes
Next braille line command works as expected in Notepad++ documents.

Description of development approach
The collapse method is overriden for Scintilla textInfo, so that textInfo is expanded to line before collapsing to end. In this way the cursor is properly moved to the end of the document when running the braille next line command.
  • Loading branch information
nvdaes authored Nov 27, 2024
1 parent 96fe482 commit 70cd311
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
10 changes: 10 additions & 0 deletions source/NVDAObjects/window/scintilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@ def _getCharacterOffsets(self, offset):
tempOffset -= 1
return [start, end]

def collapse(self, end: bool = False):
"""Before collapsing to end, if no text is selected, TextInfo is expanded to line.
This fixes a bug where next braille line command didn't move the cursor to the last empty line
in Notepad++ documents.
https://github.com/nvaccess/nvda/issues/17430
"""
if end and self.obj.makeTextInfo(textInfos.POSITION_SELECTION).isCollapsed:
self.expand(textInfos.UNIT_LINE)
super().collapse(end=end)


# The Scintilla NVDA object, inherists the generic MSAA NVDA object
class Scintilla(EditableTextWithAutoSelectDetection, Window):
Expand Down
6 changes: 4 additions & 2 deletions user_docs/en/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ Specifically, MathML inside of span and other elements that have the attribute `
* If the plugins are reloaded while a browseable message is opened, NVDA will no longer fail to report subsequent focus moves. (#17323, @CyrilleB79)
* When using applications such as Skype, Discord, Signal and Phone Link for audio communication, NVDA speech and sounds no longer decrease in volume. (#17349, @jcsteh)
* Opening the NVDA Python Console will no longer fail in case an error occurs while retrieving snapshot variables. (#17391, @CyrilleB79)
* In Notepad and other UIA documents on Windows 11, if the last line is empty, the `braille next line command` will move the cursor to the last line.
In any document, if the cursor is on the last line, it will be moved to the end when using this command. (#17251, @nvdaes)
* In Notepad and other UIA documents, and Notepad++ documents on Windows 11, if the last line is empty, the "braille next line command" will move the cursor to the last line.
In any document, if the cursor is on the last line, it will be moved to the end when using this command.
(#17251, #17430, @nvdaes)

### Changes for Developers

Expand Down Expand Up @@ -119,6 +120,7 @@ As the NVDA update check URL is now configurable directly within NVDA, no replac
* `SymphonyDocument.script_toggleTextAttribute` to `SymphonyDocument.script_changeTextFormatting`
* The `space` keyword argument for `brailleDisplayDrivers.seikantk.InputGesture` now expects an `int` rather than a `bool`. (#17047, @school510587)
* The `[upgrade]` configuration section including `[upgrade][newLaptopKeyboardLayout]` has been removed. (#17191)
* In `NVDAObjects.window.scintilla.ScintillaTextInfo`, if no text is selected, the `collapse` method is overriden to expand to line if the `end` parameter is set to `True` (#17431, @nvdaes)

#### Deprecations

Expand Down

0 comments on commit 70cd311

Please sign in to comment.