Skip to content

Commit 98dfd1c

Browse files
authored
Merge c8d65b8 into 826ef91
2 parents 826ef91 + c8d65b8 commit 98dfd1c

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

source/NVDAObjects/IAccessible/__init__.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,14 @@ def _getCaretOffset(self):
274274
raise RuntimeError("no active caret in this object")
275275
return offset
276276

277-
def _setCaretOffset(self, offset):
277+
def _setCaretOffset(self, offset: int) -> None:
278+
iaTextObject = self.obj.IAccessibleTextObject
279+
if offset > (nCharacters := iaTextObject.nCharacters):
280+
log.debugWarning(
281+
f"{offset=} is greater than IAccessibleText::{nCharacters=}. Clamping to {nCharacters}.",
282+
stack_info=True,
283+
)
284+
offset = nCharacters
278285
self.obj.IAccessibleTextObject.SetCaretOffset(offset)
279286

280287
def _getSelectionOffsets(self):

source/NVDAObjects/IAccessible/ia2TextMozilla.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,16 @@ def _findNextContent(self, origin, moveBack=False, limitToInline=False):
684684
pass
685685
return ti, obj
686686

687-
def move(self, unit, direction, endPoint=None):
687+
def move(
688+
self,
689+
unit: int,
690+
direction: str,
691+
endPoint: str | None = None,
692+
) -> int:
688693
if direction == 0:
689694
return 0
695+
if self._makeRawTextInfo(self.obj, textInfos.POSITION_ALL)._getStoryLength() == 0:
696+
return 0
690697

691698
if not endPoint or endPoint == "start":
692699
moveTi = self._start

user_docs/en/changes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The available options are:
2424
* The Seika Notetaker driver now correctly generates braille input for space, backspace and dots with space/backspace gestures. (#16642, @school510587)
2525
* In on-demand speech mode, NVDA does not talk anymore when a message is opened in Outlook, when a new page is loaded in a browser or during the slideshow in PowerPoint. (#16825, @CyrilleB79)
2626
* In Mozilla Firefox, moving the mouse over text before or after a link now reliably reports the text. (#15990, @jcsteh)
27-
27+
* NVDA no longer throws an error when panning the braille display forward in some empty edit controls. (#16927)
2828

2929
### Changes for Developers
3030

0 commit comments

Comments
 (0)