From b897f845848fa84a0b2d5b76949d18bff312af4d Mon Sep 17 00:00:00 2001 From: toonn Date: Sat, 16 Jan 2021 21:04:48 +0100 Subject: 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. --- ranger/gui/widgets/console.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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: -- cgit 1.4.1-2-gfad0