summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-02-18 21:58:37 +0100
committerhut <hut@lavabit.com>2010-03-09 14:40:22 +0100
commitea3b13663ea3bbf42cd3472750ee7e00e9093ca4 (patch)
tree6dfc99b936a28d6e47c473c9a100cb97fb003c6e /ranger
parent13ecffe7ffa5c80cd69d55419f230c97d06ab23e (diff)
downloadranger-ea3b13663ea3bbf42cd3472750ee7e00e9093ca4.tar.gz
keyparser: allow passive actions (for hints, show bookmarks)
Diffstat (limited to 'ranger')
-rw-r--r--ranger/container/keymap.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/ranger/container/keymap.py b/ranger/container/keymap.py
index 70faa0d0..23f26448 100644
--- a/ranger/container/keymap.py
+++ b/ranger/container/keymap.py
@@ -18,6 +18,7 @@ from inspect import isfunction, getargspec
 from ranger.ext.tree import Tree
 
 MAX_ALIAS_RECURSION = 20
+PASSIVE_ACTION = 9003
 DIRKEY = 9001
 ANYKEY = 9002
 FUNC = 'func'
@@ -207,8 +208,8 @@ class KeyBuffer(object):
 		return True
 
 	def _do_eval_command(self, key):
+		assert isinstance(self.tree_pointer, dict), self.tree_pointer
 		try:
-			assert isinstance(self.tree_pointer, dict), self.tree_pointer
 			self.tree_pointer = self.tree_pointer[key]
 		except TypeError:
 			print(self.tree_pointer)
@@ -230,6 +231,11 @@ class KeyBuffer(object):
 				self.failure = True
 				return None
 		else:
+			if isinstance(self.tree_pointer, dict):
+				try:
+					self.command = self.tree_pointer[PASSIVE_ACTION]
+				except (KeyError, TypeError):
+					self.command = None
 			self._try_to_finish()
 
 	def _try_to_finish(self, rec=MAX_ALIAS_RECURSION):
@@ -274,10 +280,12 @@ class KeyBuffer(object):
 				return self.command
 			if self.failure:
 				break
+		return self.command
 
 key_map = {
 	'dir': DIRKEY,
 	'any': ANYKEY,
+	'psv': PASSIVE_ACTION,
 	'cr': ord("\n"),
 	'enter': ord("\n"),
 	'space': ord(" "),
d=ac07e589b3e912c704c2011d543f18b16712ff15'>ac07e589 ^
9c1056f5 ^
1a4de9dd ^















ce2c1efc ^
1a4de9dd ^















c8a3ccbe ^
1a4de9dd ^
1f08b541 ^







37d53a70 ^
1f08b541 ^


c504ca56 ^


















































































1a4de9dd ^



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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158