about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWojciech Siewierski <wojciech@siewierski.eu>2020-07-07 23:11:36 +0200
committerGitHub <noreply@github.com>2020-07-07 23:11:36 +0200
commit01efdae6aa2384ac3e634a89c910659d4624c55c (patch)
tree07a425fdfd08662e1c53d342a8d40c0ed48a5b76
parent81305e1f53b0ef98d863e987a3551025633a076b (diff)
parent46d083e7b91c48dcbb96922232e9b4571a0e8d7c (diff)
downloadranger-01efdae6aa2384ac3e634a89c910659d4624c55c.tar.gz
Merge pull request #2034 from toonn/py-version-checks
Missed a couple py3 version checks
-rw-r--r--ranger/gui/widgets/console.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index bf8a12c0..88a59136 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -10,6 +10,7 @@ import os
 import re
 from collections import deque
 
+from ranger import PY3
 from ranger.gui.widgets import Widget
 from ranger.ext.direction import Direction
 from ranger.ext.widestring import uwid, WideString
@@ -216,7 +217,8 @@ class Console(Widget):  # pylint: disable=too-many-instance-attributes,too-many-
             self.unicode_buffer, self.line, self.pos = result
             self.on_line_change()
 
-    def _add_character(self, key, unicode_buffer, line, pos):
+    @staticmethod
+    def _add_character(key, unicode_buffer, line, pos):
         # Takes the pressed key, a string "unicode_buffer" containing a
         # potentially incomplete unicode character, the current line and the
         # position of the cursor inside the line.
@@ -228,7 +230,7 @@ class Console(Widget):  # pylint: disable=too-many-instance-attributes,too-many-
             except ValueError:
                 return unicode_buffer, line, pos
 
-        if self.fm.py3:
+        if PY3:
             if len(unicode_buffer) >= 4:
                 unicode_buffer = ""
             if ord(key) in range(0, 256):
@@ -280,7 +282,7 @@ class Console(Widget):  # pylint: disable=too-many-instance-attributes,too-many-
         direction = Direction(keywords)
         if direction.horizontal():
             # Ensure that the pointer is moved utf-char-wise
-            if self.fm.py3:
+            if PY3:
                 if self.question_queue:
                     umax = len(self.question_queue[0][0]) + 1 - self.wid
                 else:
@@ -425,7 +427,7 @@ class Console(Widget):  # pylint: disable=too-many-instance-attributes,too-many-
                 self.close(trigger_cancel_function=False)
             return
         # Delete utf-char-wise
-        if self.fm.py3:
+        if PY3:
             left_part = self.line[:self.pos + mod]
             self.pos = len(left_part)
             self.line = left_part + self.line[self.pos + 1:]