Skip to content

Commit 7196fee

Browse files
authored
Merge 75d64ec into d3ba21a
2 parents d3ba21a + 75d64ec commit 7196fee

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

source/documentBase.py

Lines changed: 25 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,18 @@ 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
162+
# to allow users being able to skip merged cells without affecting the initial column/row index.
163+
# For more info see issue #11919 and #7278.
164+
if (self.selection == self.lastTableSelection) and (self.lastTableAxis == axis):
165+
if axis == "row":
166+
origCol = self.lastTableCoordinate
167+
origColSpan = self.lastTableCoordinateSpan
168+
else:
169+
origRow = self.lastTableCoordinate
170+
origRowSpan = self.lastTableCoordinateSpan
171+
156172
try:
157173
info = self._getNearestTableCell(tableID, self.selection, origRow, origCol, origRowSpan, origColSpan, movement, axis)
158174
except LookupError:
@@ -165,6 +181,15 @@ def _tableMovementScriptHelper(self, movement="next", axis=None):
165181
speech.speakTextInfo(info,formatConfig=formatConfig,reason=controlTypes.REASON_CARET)
166182
info.collapse()
167183
self.selection = info
184+
self.lastTableSelection = self.selection
185+
self.lastTableAxis = axis
186+
if axis == "row":
187+
self.lastTableCoordinate = origCol
188+
self.lastTableCoordinateSpan = origColSpan
189+
else:
190+
self.lastTableCoordinate = origRow
191+
self.lastTableCoordinateSpan = origRowSpan
192+
168193

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

0 commit comments

Comments
 (0)