diff options
author | toonn <toonn@toonn.io> | 2021-01-16 21:04:48 +0100 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2021-01-16 21:35:46 +0100 |
commit | b897f845848fa84a0b2d5b76949d18bff312af4d (patch) | |
tree | 471e1e8d44f12b3ab711d08bced761331d616585 | |
parent | 421e2e919bce612c222e6a7d8f62fe98dcded938 (diff) |
transpose_chars: Add explicit check for start of line
There's no sensible action at the start of the line but we don't want to
issue the warning about invalid regions either.
-rw-r--r-- | ranger/gui/widgets/console.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 2ff1943d..876081f8 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -456,7 +456,9 @@ class Console(Widget): # pylint: disable=too-many-instance-attributes,too-many- return line def transpose_chars(self): - if self.pos == len(self.line): + if self.pos == 0: + return + elif self.pos == len(self.line): x = max(0, self.pos - 2), max(0, self.pos - 1) y = max(0, self.pos - 1), self.pos else: |