Skip to content

Commit

Permalink
Fix skip clutter
Browse files Browse the repository at this point in the history
  • Loading branch information
mltony committed Dec 21, 2024
1 parent b792759 commit d92177b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
11 changes: 2 additions & 9 deletions addon/globalPlugins/browserNav/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,8 @@ def preCaretMovementScriptHelper(self, gesture,unit, direction=None,posConstant=
oldSelection = self.selection
if (
(
(
getConfig("skipEmptyParagraphs")
and unit == textInfos.UNIT_PARAGRAPH
) or (
getConfig("skipEmptyLines")
and unit == textInfos.UNIT_LINE
) or (
quickJump.needOverride_caretMovement(self)
)
quickJump.isSkipClutterEnabledForThisUnit(unit)
or quickJump.needOverride_caretMovement(self)
)
and direction is not None
and posConstant==textInfos.POSITION_SELECTION
Expand Down
12 changes: 11 additions & 1 deletion addon/globalPlugins/browserNav/quickJump.py
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,16 @@ def needOverride_caretMovement(self):
suppressTreeLevel = getSuppressTreeLevel(url, globalConfig)
return suppressAriaLabelEditable or suppressTreeLevel

def isSkipClutterEnabledForThisUnit(unit):
return (
(
getConfig("skipEmptyParagraphs")
and unit == textInfos.UNIT_PARAGRAPH
) or (
getConfig("skipEmptyLines")
and unit == textInfos.UNIT_LINE
)
)

def caretMovementWithAutoSkip(self, gesture,unit, direction=None,posConstant=textInfos.POSITION_SELECTION, *args, **kwargs):
url = getUrl(self)
Expand All @@ -1722,7 +1732,7 @@ def caretMovementWithAutoSkip(self, gesture,unit, direction=None,posConstant=tex
expandInfo = info.copy()
expandInfo.expand(unit)
expandText = expandInfo.text
if shouldSkipClutter(expandInfo, bookmarks):
if isSkipClutterEnabledForThisUnit(unit) and shouldSkipClutter(expandInfo, bookmarks):
skipped = True
continue
break
Expand Down

0 comments on commit d92177b

Please sign in to comment.