summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-12 20:42:58 +0200
committerhut <hut@lavabit.com>2010-04-12 20:42:58 +0200
commitd9d3243bdfeae03e7c4641bde73103748992b3dc (patch)
tree6abb0339781456a395c7baa87056a7451d260fa2 /ranger
parent11616e7211d50fc0856242c7fb2adc08279c5f60 (diff)
downloadranger-d9d3243bdfeae03e7c4641bde73103748992b3dc.tar.gz
fix alt key for xterm
Diffstat (limited to 'ranger')
-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,
 }
 
 
_directory.py?h=v1.4.2&id=fe179145892d5835b33c79ab90b6ba257cf5f12d'>fe179145 ^
fae694a0 ^

fe179145 ^
fae694a0 ^

fe179145 ^
5822dff7 ^
9506fb8e ^
fae694a0 ^
9506fb8e ^
fae694a0 ^
fe179145 ^

fae694a0 ^
fe179145 ^
fae694a0 ^


4c05e43d ^

fae694a0 ^

fe179145 ^

fae694a0 ^




9506fb8e ^
fae694a0 ^
fae694a0 ^
1159f9ec ^



fe179145 ^
5822dff7 ^
9506fb8e ^
fae694a0 ^
fe179145 ^
fae694a0 ^
fe179145 ^

fae694a0 ^


fe179145 ^
fae694a0 ^
9506fb8e ^

f6f26231 ^
4c05e43d ^
f6f26231 ^







9506fb8e ^
fae694a0 ^

f6f26231 ^










4c05e43d ^

fae694a0 ^

fe179145 ^
5822dff7 ^

fe179145 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105