about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2021-01-16 20:46:59 +0100
committertoonn <toonn@toonn.io>2021-01-16 21:35:46 +0100
commitdd41a90d63d9ad8268f231ad8bf6be9a24387aa9 (patch)
tree3a2a042ac06f84127e9eedbd8918a6e4faddc7b3 /ranger
parent95d8f9ba814f9723e2c0273202aaa2fc3e86b3c2 (diff)
downloadranger-dd41a90d63d9ad8268f231ad8bf6be9a24387aa9.tar.gz
transpose_subr: Check lower bound
Allowing negative regions makes it harder to verify there's no overlap
between regions.
Diffstat (limited to 'ranger')
-rw-r--r--ranger/gui/widgets/console.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index a6d9117c..6c184395 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -442,8 +442,8 @@ class Console(Widget):  # pylint: disable=too-many-instance-attributes,too-many-
     def transpose_subr(self, line, x, y):
         # Transpose substrings x & y of line
         # x & y are tuples of length two containing positions of endpoints
-        if not (x[0] <= x[1] <= y[0] <= y[1] <= len(line)
-                or x[0] == y[0] <= x[1] == y[1] <= len(line)):
+        if not (0 <= x[0] <= x[1] <= y[0] <= y[1] <= len(line)
+                or 0<= x[0] == y[0] <= x[1] == y[1] <= len(line)):
             self.fm.notify("Tried to transpose invalid regions.", bad=True)
             return line