Skip to content

Commit cb44698

Browse files
authored
Merge 651e9e1 into d3ba21a
2 parents d3ba21a + 651e9e1 commit cb44698

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

source/documentBase.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ def _getNearestTableCell(self, tableID, startPos, origRow, origCol, origRowSpan,
140140
destCol+=1 if movement=="next" else -1
141141
raise LookupError
142142

143+
lastTableSelection = None
144+
lastTableAxis = None
145+
lastTableCoordinate = None
146+
lastTableCoordinateSpan = None
143147
def _tableMovementScriptHelper(self, movement="next", axis=None):
144148
if isScriptWaiting():
145149
return
@@ -153,6 +157,17 @@ def _tableMovementScriptHelper(self, movement="next", axis=None):
153157
ui.message(_("Not in a table cell"))
154158
return
155159

160+
# The follwoing lines check whether user has been issuing table navigation commands repeatedly.
161+
# In this case, instead of using current column/row index, we used cached value to allow users being able to skip merged cells without affecting the initial column/row index.
162+
# For more info see issue #11919 and #7278.
163+
if (self.selection == self.lastTableSelection) and (self.lastTableAxis == axis):
164+
if axis == "row":
165+
origCol = self.lastTableCoordinate
166+
origColSpan = self.lastTableCoordinateSpan
167+
else:
168+
origRow = self.lastTableCoordinate
169+
origRowSpan = self.lastTableCoordinateSpan
170+
156171
try:
157172
info = self._getNearestTableCell(tableID, self.selection, origRow, origCol, origRowSpan, origColSpan, movement, axis)
158173
except LookupError:
@@ -165,6 +180,15 @@ def _tableMovementScriptHelper(self, movement="next", axis=None):
165180
speech.speakTextInfo(info,formatConfig=formatConfig,reason=controlTypes.REASON_CARET)
166181
info.collapse()
167182
self.selection = info
183+
self.lastTableSelection = self.selection
184+
self.lastTableAxis = axis
185+
if axis == "row":
186+
self.lastTableCoordinate = origCol
187+
self.lastTableCoordinateSpan = origColSpan
188+
else:
189+
self.lastTableCoordinate = origRow
190+
self.lastTableCoordinateSpan = origRowSpan
191+
168192

169193
def script_nextRow(self, gesture):
170194
self._tableMovementScriptHelper(axis="row", movement="next")

0 commit comments

Comments
 (0)