Skip to content

Commit 95627e8

Browse files
Merge 7b0a2f6 into 2adb77c
2 parents 2adb77c + 7b0a2f6 commit 95627e8

2 files changed

Lines changed: 39 additions & 0 deletions

File tree

source/appModules/soffice.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import speech
2626
import api
2727
import braille
28+
import inputCore
2829
import languageHandler
2930
import vision
3031

@@ -318,6 +319,43 @@ def _get_locationText(self):
318319
class SymphonyDocument(CompoundDocument):
319320
TextInfo = SymphonyDocumentTextInfo
320321

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

322360
class AppModule(appModuleHandler.AppModule):
323361

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 ``control+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)