From d92177b551369652c7d7db8f1b0ee3aede4fc97d Mon Sep 17 00:00:00 2001 From: mltony Date: Fri, 20 Dec 2024 16:51:29 -0800 Subject: [PATCH] Fix skip clutter --- addon/globalPlugins/browserNav/__init__.py | 11 ++--------- addon/globalPlugins/browserNav/quickJump.py | 12 +++++++++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/addon/globalPlugins/browserNav/__init__.py b/addon/globalPlugins/browserNav/__init__.py index 2fd9df2..5ffc0e0 100644 --- a/addon/globalPlugins/browserNav/__init__.py +++ b/addon/globalPlugins/browserNav/__init__.py @@ -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 diff --git a/addon/globalPlugins/browserNav/quickJump.py b/addon/globalPlugins/browserNav/quickJump.py index a45d74a..f8f469e 100644 --- a/addon/globalPlugins/browserNav/quickJump.py +++ b/addon/globalPlugins/browserNav/quickJump.py @@ -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) @@ -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