Skip to content

Commit

Permalink
MozillaCompoundTextInfo: Don't adjust for the end of a line at the en…
Browse files Browse the repository at this point in the history
…d of an object. (#16914)

Fixup of #16745.

Summary of the issue:
In my work on #16745, I apparently neglected to consider the end of an inline object such as a link. In that case, adjusting for the line end caused NVDA to report blank when moving to the character after the link instead of reporting the actual character.

Description of user facing changes
When editing text in Firefox, NVDA now reports the correct character instead of blank when pressing right arrow to move out of a link. This doesn't need a change log entry if we can get this into beta because the bug will not have shipped in release.

Description of development approach
Return False in _isCaretAtEndOfLine if we're at the end of an object. While the end of an object could indeed be the end of a line, we don't need the special adjustment in this case and the adjustment causes problems if it isn't the end of a line.

This also means we can remove the change in #16763 because that was only ever a problem for a line feed at the end of an object anyway. This new fix covers both cases
  • Loading branch information
jcsteh authored Jul 29, 2024
1 parent 9ac567a commit 7227d51
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions source/NVDAObjects/IAccessible/ia2TextMozilla.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,12 @@ def _isCaretAtEndOfLine(self, caretObj: IAccessible) -> bool:
# means this is not the insertion point at the end of a line.
if start != end:
return False
# If there is a line feed before us, this is an empty line. We don't want
# to do any special adjustment in this case. Otherwise, we will report the
# previous line instead of the empty one.
if start > 0 and caretObj.IAccessibleTextObject.text(start - 1, start) == "\n":
# If this is the end of the object, it might be the end of a line, but it
# might just be the end of the object on a line containing multiple objects.
# It's also possible that this is an empty last line, in which case any
# adjustment would cause us to report the previous line instead of the empty
# one. Either way, we don't need the special end of line adjustment.
if start > 0 and start == caretObj.IAccessibleTextObject.nCharacters:
return False
return True
except COMError:
Expand Down

0 comments on commit 7227d51

Please sign in to comment.