Skip to content

Commit 80c8fef

Browse files
Merge 7834868 into fc28c48
2 parents fc28c48 + 7834868 commit 80c8fef

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

source/appModules/soffice.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,43 @@ def _get_locationText(self):
318318
class SymphonyDocument(CompoundDocument):
319319
TextInfo = SymphonyDocumentTextInfo
320320

321+
# override base class implementation because that one assumes
322+
# that the text retrieved from the text info for the text unit
323+
# is the same as the text that actually gets removed, which at
324+
# least isn't true for Writer paragraphs when removing a word
325+
# followed by whitespace using Ctrl+Backspace
326+
def _backspaceScriptHelper(self, unit, gesture):
327+
try:
328+
oldInfo = self.makeTextInfo(textInfos.POSITION_CARET)
329+
if not isinstance(oldInfo, SymphonyDocumentTextInfo):
330+
super(SymphonyDocument, self)._backspaceScriptHelper(unit, gesture)
331+
return
332+
ia2TextObj = oldInfo._start.obj.IAccessibleTextObject
333+
oldCaretOffset = ia2TextObj.caretOffset
334+
oldText = ia2TextObj.text(0, ia2TextObj.nCharacters)
335+
except NotImplementedError:
336+
gesture.send()
337+
return
338+
339+
gesture.send()
340+
341+
newInfo = self.makeTextInfo(textInfos.POSITION_CARET)
342+
ia2TextObj = newInfo._start.obj.IAccessibleTextObject
343+
newCaretOffset = ia2TextObj.caretOffset
344+
newText = ia2TextObj.text(0, ia2TextObj.nCharacters)
345+
346+
# double-check check that text between previous and current
347+
# caret position was deleted and announce it
348+
deletedText = oldText[newCaretOffset:oldCaretOffset]
349+
if newText == oldText[0:newCaretOffset] + oldText[oldCaretOffset:]:
350+
if len(deletedText) > 1:
351+
speech.speakMessage(deletedText)
352+
else:
353+
speech.speakSpelling(deletedText)
354+
self._caretScriptPostMovedHelper(None, gesture, newInfo)
355+
else:
356+
log.warning('Backspace did not remove text as expected.')
357+
321358

322359
class AppModule(appModuleHandler.AppModule):
323360

user_docs/en/changes.t2t

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ What's New in NVDA
1616
- The following commands now support two and three presses to spell the reported information and spell with character descriptions: report selection, report clipboard text and report focused object. (#15449)
1717
- The option "Report role when mouse enters object" in NVDA's mouse settings category has been renamed to "Report object when mouse enters it".
1818
This option now announces additional relevant information about an object when the mouse enters it, such as states (checked/pressed) or cell coordinates in a table. (#15420)
19+
- In LibreOffice, words deleted using the Ctrl+Backspace keyboard shortcut are now also properly announced when the deleted word is followed by whitespace (like spaces and tabs). (#15436)
1920
-
2021

2122
== Bug Fixes ==

0 commit comments

Comments
 (0)