summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/options.py4
-rw-r--r--ranger/gui/ui.py10
-rw-r--r--ranger/shared/settings.py1
3 files changed, 13 insertions, 2 deletions
diff --git a/ranger/defaults/options.py b/ranger/defaults/options.py
index d96955b7..46723aa8 100644
--- a/ranger/defaults/options.py
+++ b/ranger/defaults/options.py
@@ -118,3 +118,7 @@ def colorscheme_overlay(context, fg, bg, attr):
 
 # The above function was just an example, let's set it back to None
 colorscheme_overlay = None
+
+# Enable this if key combinations with the Alt Key don't work for you.
+# (Especially on xterm)
+xterm_alt_key = False
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 41acb39f..983cffc8 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -164,6 +164,10 @@ class UI(DisplayableContainer):
 		else:
 			kbuf.clear()
 
+	def handle_keys(self, *keys):
+		for key in keys:
+			self.handle_key(key)
+
 	def handle_input(self):
 		key = self.win.getch()
 		if key is 27 or key >= 128 and key < 256:
@@ -177,8 +181,10 @@ class UI(DisplayableContainer):
 					keys.append(getkey)
 			if len(keys) == 1:
 				keys.append(-1)
-			for key in keys:
-				self.handle_key(key)
+			if self.settings.xterm_alt_key:
+				if len(keys) == 2 and keys[1] in range(127, 256):
+					keys = [27, keys[1] - 128]
+			self.handle_keys(*keys)
 			self.set_load_mode(previous_load_mode)
 			if self.settings.flushinput:
 				curses.flushinp()
diff --git a/ranger/shared/settings.py b/ranger/shared/settings.py
index e7098792..ebbe12c7 100644
--- a/ranger/shared/settings.py
+++ b/ranger/shared/settings.py
@@ -44,6 +44,7 @@ ALLOWED_SETTINGS = {
 	'colorscheme': str,
 	'colorscheme_overlay': (type(None), type(lambda:0)),
 	'hidden_filter': lambda x: isinstance(x, str) or hasattr(x, 'match'),
+	'xterm_alt_key': bool,
 }