Skip to content
Merged
Show file tree
Hide file tree
Changes from 80 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
c9ea40f
Add both normal and block paragraph navigation for apps which do not …
rob-aph May 27, 2022
34b118e
Fix NVDA handing in very large texts when navigating between paragraphs
rob-aph Jun 21, 2022
7699c88
Update source/config/configSpec.py
rob-aph Jun 27, 2022
e42e9d0
Implement recommended changes from NVAccess
rob-aph Jun 27, 2022
d2eb59d
Once we get a valid TextInfo, paragraph movement commands always retu…
rob-aph Jun 28, 2022
076194c
Demo of paragraph navigation in Microsoft Word documents
rob-aph Jul 12, 2022
793ba62
Revert "Demo of paragraph navigation in Microsoft Word documents"
rob-aph Jul 18, 2022
7454c55
Remove check for Microsoft Word -- we never get called when using it
rob-aph Jul 18, 2022
a4bd1f0
Move settings strings to paragraphHelper, and add support for the 'au…
rob-aph Jul 19, 2022
8d09ce1
Add unassigned script to toggle through paragraph navigation styles
rob-aph Jul 19, 2022
2e2e95a
Thunderbird support -- both when reading and writing messages
rob-aph Jul 29, 2022
0b2e5ea
Force UIATextInfo objects to scroll new paragraph into view when navi…
rob-aph Jul 29, 2022
34d7049
Update the selection in the CursorManager after moving to a new parag…
rob-aph Jul 29, 2022
647d34d
Only update CursorManager.selection if moving to a paragraph is succe…
rob-aph Aug 1, 2022
b30cff3
Fix bug in moveToBlockParagraph where moving backwards could sometime…
rob-aph Aug 1, 2022
e8bc4f3
Rely exclusively on class of TextInfo object to determine if TextInfo…
rob-aph Aug 4, 2022
18ff16a
variable change -- lines becomes numLines for clarity
rob-aph Aug 4, 2022
53a7677
Break large paragraphs into chunks and speak the chunks rather than t…
rob-aph Aug 4, 2022
86b6451
Merge branch 'master' into paragraphNavigation
rob-aph Aug 29, 2022
dcdedde
Annotation and conditional branching fixes requested in second review
rob-aph Aug 8, 2022
301193a
Feature Flag attempt 1 -- crashing
rob-aph Aug 26, 2022
472c382
Merge branch 'master' into temp
rob-aph Sep 1, 2022
0a72db9
Feature flag updates
rob-aph Sep 1, 2022
aa58ec8
Feature Flag: Finish up -- toggling now works, use helper methods, etc.
rob-aph Sep 2, 2022
c507157
Merge branch 'master' into paragraphNavigation
rob-aph Sep 15, 2022
3dcaebd
Touch-ups
rob-aph Sep 15, 2022
c1ee45a
Clarify comment regarding Microsoft Word to indicate that paragraph n…
rob-aph Sep 16, 2022
40ad593
Fixes for latest review
rob-aph Sep 20, 2022
26996e0
User Guide additions
rob-aph Sep 21, 2022
8fad7f8
bindHelpEvent
rob-aph Sep 23, 2022
92999f4
Update user_docs/en/userGuide.t2t
rob-aph Sep 26, 2022
a828b6f
Update user_docs/en/userGuide.t2t
rob-aph Sep 26, 2022
d83ade4
Update source/gui/settingsDialogs.py
rob-aph Sep 26, 2022
c59d304
Update source/utils/paragraphHelper.py
rob-aph Sep 26, 2022
f435875
Use new enums
rob-aph Sep 26, 2022
dd2210f
paragraphHelper touchups
rob-aph Sep 26, 2022
6afe102
User guide: Definition list and line break
rob-aph Sep 26, 2022
abd1aa6
User guide: Get rid of Enabled in definition list -- doesn't make any…
rob-aph Sep 26, 2022
4b4bc80
Copyright and import touch-ups
rob-aph Sep 27, 2022
7c74f65
Merge branch 'master' into paragraphNavigation
rob-aph Sep 28, 2022
c519385
cursorManager: Remove file name from header
rob-aph Sep 28, 2022
2566561
dataclass for error tone constants
rob-aph Sep 28, 2022
a47741a
Use _Offset enumeration in all possible places
rob-aph Sep 28, 2022
96e21b7
_splitParagraphIntoChunks: support '.', '?', and '!' as sentence term…
rob-aph Sep 28, 2022
ce48a4a
Update source/utils/paragraphHelper.py
rob-aph Sep 30, 2022
1c0d0ba
Remove unneded import of frozenset
rob-aph Oct 3, 2022
ac317ae
Add comment to _splitParagraphIntoChunks explaining optional nature o…
rob-aph Oct 3, 2022
e4fc564
Refactor splitting of paragraphs into chunks
rob-aph Oct 10, 2022
74cfa5e
Some cleanup
rob-aph Oct 11, 2022
97d7907
_splitParagraphIntoChunks is now a generator
rob-aph Oct 11, 2022
730bfb6
Add docstring for findEndOfSentence
rob-aph Oct 11, 2022
955192d
Update source/utils/paragraphHelper.py
rob-aph Oct 12, 2022
92dd579
findEndOfSentence now marked as private
rob-aph Oct 12, 2022
919e2ea
_findEndOfSentence now includes line termination characters as part o…
rob-aph Oct 12, 2022
e063ab8
Issue messages instead of beeping when no more paragraphs in specifie…
rob-aph Oct 12, 2022
8f459cf
User Guide: Remove mention of beeps when no more paragraphs
rob-aph Oct 17, 2022
cd6a8a7
_findEndOfSentence returns None if end of sentence not found
rob-aph Oct 17, 2022
06342f5
Clarified translator comment regarding messages given when there are …
rob-aph Oct 17, 2022
2db4a20
Move paragraph navigation modules to a new documentNavigation package
rob-aph Oct 17, 2022
380b466
Fix paragraphHelper to expect None from _findEndOfSentence
rob-aph Oct 18, 2022
27f3814
_findEndOfSentence: Ignore empty strings
rob-aph Oct 18, 2022
82e1dc2
Unit tests for documentNavigation.sentenceHelper
rob-aph Oct 18, 2022
a154f05
getTextInfoAtCaret() now marked as private
rob-aph Oct 18, 2022
6f7ada4
moveToParagraph() now takes a TextInfo -- added for future unit tests
rob-aph Oct 18, 2022
9f2fbf9
Improved sentenceHelper tests
rob-aph Oct 24, 2022
1d08d29
Update paragraph style names in code and user guide
rob-aph Oct 24, 2022
91bbbbc
Bug fix: moveToParagraph was not respecting speakNew parameter
rob-aph Oct 25, 2022
f304f86
Break code which moves the TextInfo to the desired paragraph out into…
rob-aph Oct 25, 2022
21e57d4
paragraphHelper: PREFERRED_CHUNK_SIZE now visible to other modules
rob-aph Oct 26, 2022
1d9f01a
Unit tests for paragraphHelper
rob-aph Oct 26, 2022
2fdd8b5
Merge branch 'master' into paragraphNavigation
rob-aph Nov 2, 2022
585b6b4
Paragraph navigation unit tests: implement suggested changes
rob-aph Nov 9, 2022
11e2a40
Rename functions, improve unit tests, etc.
rob-aph Nov 11, 2022
5ffd3b9
Fixes for multi
rob-aph Nov 16, 2022
6f8d9b5
Break sentence helper unit tests down to test one aspect per test
rob-aph Nov 21, 2022
b622d33
sentenceHelper: Optimize by using end-of-line indicator in RegEx
rob-aph Dec 2, 2022
c986a49
sentenceHelper: Combine WESTERN_TERMINATORS and FULL_WIDTH_TERMINATOR…
rob-aph Dec 15, 2022
7c1e1ba
Unit tests for combined western and full-width sentences
rob-aph Dec 15, 2022
cbf4f08
_findEndOfSentence becomes _findNextEndOfSentence
rob-aph Dec 16, 2022
d5a00ad
Replace 'toggle' with 'cycle' regarding cycling through paragraph sty…
rob-aph Dec 16, 2022
b7b12eb
Merge remote-tracking branch 'origin/master' into paragraphNavigation
seanbudd Dec 18, 2022
4a33125
Merge remote-tracking branch 'origin/master' into paragraphNavigation
seanbudd Dec 20, 2022
42a4cc2
update changes
seanbudd Dec 20, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion source/config/configSpec.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2022 NV Access Limited, Babbage B.V., Davy Kager, Bill Dengler, Julien Cochuyt,
# Joseph Lee, Dawid Pieper, mltony, Bram Duvigneau, Cyrille Bougot
# Joseph Lee, Dawid Pieper, mltony, Bram Duvigneau, Cyrille Bougot, Rob Meredith
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

Expand Down Expand Up @@ -225,6 +225,9 @@
reportFrames = boolean(default=true)
reportClickable = boolean(default=true)

[documentNavigation]
paragraphStyle = featureFlag(optionsEnum="ParagraphNavigationFlag", behaviorOfDefault="application")

[reviewCursor]
simpleReviewMode = boolean(default=True)
followFocus = boolean(default=True)
Expand Down
20 changes: 19 additions & 1 deletion source/config/featureFlagEnums.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2022 NV Access Limited, Bill Dengler
# Copyright (C) 2022 NV Access Limited, Bill Dengler, Rob Meredith
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

Expand Down Expand Up @@ -67,6 +67,24 @@ def __bool__(self):
return self == BoolFlag.ENABLED


class ParagraphNavigationFlag(DisplayStringEnum):
@property
def _displayStringLabels(self):
return {
# Translators: Label for a paragraph style in NVDA settings.
self.APPLICATION: _("Handled by application"),
# Translators: Label for a paragraph style in NVDA settings.
self.SINGLE_LINE_BREAK: _("Single line break"),
# Translators: Label for a paragraph style in NVDA settings.
self.MULTI_LINE_BREAK: _("Multi line break")
}

DEFAULT = enum.auto()
APPLICATION = enum.auto()
SINGLE_LINE_BREAK = enum.auto()
MULTI_LINE_BREAK = enum.auto()


class WindowsTerminalStrategyFlag(DisplayStringEnum):
"""
A feature flag for defining how new text is calculated in Windows Terminal
Expand Down
46 changes: 36 additions & 10 deletions source/cursorManager.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#cursorManager.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2018 NV Access Limited, Joseph Lee, Derek Riemer, Davy Kager
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
# A part of NonVisual Desktop Access (NVDA)
# Copyright (C) 2006-2022 NV Access Limited, Joseph Lee, Derek Riemer, Davy Kager, Rob Meredith
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.

"""
Implementation of cursor managers.
Expand All @@ -26,9 +25,13 @@
import braille
import vision
import controlTypes
from inputCore import SCRCAT_BROWSEMODE
from inputCore import (
SCRCAT_BROWSEMODE,
InputGesture,
)
import ui
from textInfos import DocumentWithPageTurns
from logHandler import log


class FindDialog(
Expand Down Expand Up @@ -264,12 +267,35 @@ def script_moveBySentence_forward(self,gesture):
self._caretMovementScriptHelper(gesture,textInfos.UNIT_SENTENCE,1)
script_moveBySentence_forward.resumeSayAllMode = sayAll.CURSOR.CARET

def script_moveByParagraph_back(self,gesture):
self._caretMovementScriptHelper(gesture,textInfos.UNIT_PARAGRAPH,-1)
def _handleParagraphNavigation(self, gesture: InputGesture, nextParagraph: bool) -> None:
from config.featureFlagEnums import ParagraphNavigationFlag
flag: config.featureFlag.FeatureFlag = config.conf["documentNavigation"]["paragraphStyle"]
if (
flag.calculated() == ParagraphNavigationFlag.APPLICATION
or flag.calculated() == ParagraphNavigationFlag.SINGLE_LINE_BREAK
):
self._caretMovementScriptHelper(gesture, textInfos.UNIT_PARAGRAPH, 1 if nextParagraph else -1)
elif flag.calculated() == ParagraphNavigationFlag.MULTI_LINE_BREAK:
from documentNavigation.paragraphHelper import moveToMultiLineBreakParagraph
ti = self.makeTextInfo(textInfos.POSITION_SELECTION)
passKey, moved = moveToMultiLineBreakParagraph(
nextParagraph=nextParagraph,
speakNew=not willSayAllResume(gesture),
ti=ti)
if moved:
self.selection = ti
elif passKey:
# fail over to default behavior
self._caretMovementScriptHelper(gesture, textInfos.UNIT_PARAGRAPH, 1 if nextParagraph else -1)
else:
log.error(f"Unexpected ParagraphNavigationFlag value {flag.value}")

def script_moveByParagraph_back(self, gesture: InputGesture):
self._handleParagraphNavigation(gesture, False)
script_moveByParagraph_back.resumeSayAllMode = sayAll.CURSOR.CARET

def script_moveByParagraph_forward(self,gesture):
self._caretMovementScriptHelper(gesture,textInfos.UNIT_PARAGRAPH,1)
def script_moveByParagraph_forward(self, gesture: InputGesture):
self._handleParagraphNavigation(gesture, True)
script_moveByParagraph_forward.resumeSayAllMode = sayAll.CURSOR.CARET

def script_startOfLine(self,gesture):
Expand Down
Loading