Skip to content

Commit 754c785

Browse files
authored
Merge 990c306 into 3f82ab6
2 parents 3f82ab6 + 990c306 commit 754c785

5 files changed

Lines changed: 36 additions & 0 deletions

File tree

source/braille.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,9 @@
330330
# used to separate chunks of text when programmatically joined
331331
TEXT_SEPARATOR = " "
332332

333+
# Indicator at the start of paragraphs
334+
PARAGRAPH_START = " "
335+
333336
#: Identifier for a focus context presentation setting that
334337
#: only shows as much as possible focus context information when the context has changed.
335338
CONTEXTPRES_CHANGEDCONTEXT = "changedContext"
@@ -1083,6 +1086,9 @@ def getFormatFieldBraille(field, fieldCache, isAtStart, formatConfig):
10831086
"""
10841087
textList = []
10851088
if isAtStart:
1089+
brailleConfig = config.conf["braille"]
1090+
if brailleConfig["readByParagraph"] and brailleConfig["showParagraphStart"]:
1091+
textList.append(PARAGRAPH_START)
10861092
if formatConfig["reportLineNumber"]:
10871093
lineNumber = field.get("line-number")
10881094
if lineNumber:

source/config/configSpec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
reviewRoutingMovesSystemCaret = featureFlag(\
8484
optionsEnum="ReviewRoutingMovesSystemCaretFlag", behaviorOfDefault="NEVER")
8585
readByParagraph = boolean(default=false)
86+
showParagraphStart = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="disabled")
8687
wordWrap = boolean(default=true)
8788
unicodeNormalization = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="disabled")
8889
focusContextPresentation = option("changedContext", "fill", "scroll", default="changedContext")

source/gui/settingsDialogs.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4363,8 +4363,22 @@ def makeSettings(self, settingsSizer):
43634363
wx.CheckBox(self.followCursorGroupBox, label=readByParagraphText),
43644364
)
43654365
self.bindHelpEvent("BrailleSettingsReadByParagraph", self.readByParagraphCheckBox)
4366+
self.readByParagraphCheckBox.Bind(wx.EVT_CHECKBOX, self.onReadByParagraphChange)
43664367
self.readByParagraphCheckBox.Value = config.conf["braille"]["readByParagraph"]
43674368

4369+
self.showParagraphStartCombo: nvdaControls.FeatureFlagCombo = followCursorGroupHelper.addLabeledControl(
4370+
labelText=_(
4371+
# Translators: This is a label for a combo-box in the Braille settings panel to select if start of paragraphs will be reported in braille.
4372+
"Show para&graph start",
4373+
),
4374+
wxCtrlClass=nvdaControls.FeatureFlagCombo,
4375+
keyPath=["braille", "showParagraphStart"],
4376+
conf=config.conf,
4377+
)
4378+
self.bindHelpEvent("BrailleShowParagraphStart", self.showParagraphStartCombo)
4379+
if not self.readByParagraphCheckBox.GetValue():
4380+
self.showParagraphStartCombo.Disable()
4381+
43684382
# Translators: The label for a setting in braille settings to select how the context for the focus object should be presented on a braille display.
43694383
focusContextPresentationLabelText = _("Focus context presentation:")
43704384
self.focusContextPresentationValues = [x[0] for x in braille.focusContextPresentations]
@@ -4459,6 +4473,7 @@ def onSave(self):
44594473
braille.handler.setTether(tetherChoice, auto=False)
44604474
self.brailleReviewRoutingMovesSystemCaretCombo.saveCurrentValueToConf()
44614475
config.conf["braille"]["readByParagraph"] = self.readByParagraphCheckBox.Value
4476+
self.showParagraphStartCombo.saveCurrentValueToConf()
44624477
config.conf["braille"]["wordWrap"] = self.wordWrapCheckBox.Value
44634478
self.unicodeNormalizationCombo.saveCurrentValueToConf()
44644479
config.conf["braille"]["focusContextPresentation"] = self.focusContextPresentationValues[
@@ -4484,6 +4499,9 @@ def onTetherToChange(self, evt: wx.CommandEvent) -> None:
44844499
tetherChoice = [x.value for x in TetherTo][evt.GetSelection()]
44854500
self.brailleReviewRoutingMovesSystemCaretCombo.Enable(tetherChoice != TetherTo.FOCUS.value)
44864501

4502+
def onReadByParagraphChange(self, evt):
4503+
self.showParagraphStartCombo.Enable(evt.IsChecked())
4504+
44874505
def _onModeChange(self, evt: wx.CommandEvent):
44884506
self.followCursorGroupBox.Enable(not evt.GetSelection())
44894507

user_docs/en/changes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Enhanced Microsoft Word comment command: press twice to present comment content in browsable message. (#16800, @Cary-Rowen)
1010
* Enhanced Microsoft Excel notes command: press twice to present notes content in browsable message. (#16878, @Cary-Rowen)
1111
* NVDA can now be configured to report font attributes in speech and braille separately. (#16755)
12+
* When the "Read by paragraph" option is enabled, NVDA can now be configured to indicate the start of paragraphs in braille. (#16895, @nvdaes)
1213

1314

1415
### Bug Fixes

user_docs/en/userGuide.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,6 +2163,16 @@ This means that you do not have to scroll the display at the end of each line ev
21632163
This may allow for more fluent reading of large amounts of text.
21642164
It is disabled by default.
21652165

2166+
##### Show paragraph start {#BrailleShowParagraphStart}
2167+
| . {.hideHeaderRow} |.|
2168+
|---|---|
2169+
|Options |Default (Disabled), Enabled, Disabled|
2170+
|Default |Disabled|
2171+
2172+
If enabled and "Read by paragraph" is checked, two spaces will be displayed to indicate the start of a paragraph.
2173+
This can be especially helpful in applications used to read large pieces of text, like structured documents or books.
2174+
In such documents, knowing where paragraphs start maybe important to understand the structure of the content, or to set bookmarks or annotations based on paragraph position.
2175+
21662176
##### Avoid splitting words when possible {#BrailleSettingsWordWrap}
21672177

21682178
If this is enabled, a word which is too large to fit at the end of the braille display will not be split.

0 commit comments

Comments
 (0)