summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-01-21 04:53:42 +0100
committerhut <hut@lavabit.com>2010-01-21 04:55:02 +0100
commita46c0525f3812b21cf406dbbe327a52729a0ad41 (patch)
treebd824cfa03a84bec1addabe805d90d279db6bb34
parentc8f40bb1693ea8fbb4923c547e7c0a5f89fa0282 (diff)
downloadranger-a46c0525f3812b21cf406dbbe327a52729a0ad41.tar.gz
console: fixed minor bug
-rw-r--r--ranger/commands.py6
-rw-r--r--ranger/gui/widgets/console.py17
2 files changed, 14 insertions, 9 deletions
diff --git a/ranger/commands.py b/ranger/commands.py
index a1c2f028..afb5d42c 100644
--- a/ranger/commands.py
+++ b/ranger/commands.py
@@ -200,11 +200,13 @@ class find(Command):
 		search = re.escape(search)
 		self.fm.env.last_search = re.compile(search, re.IGNORECASE)
 
-	def quick_open(self):
-		self._search()
 		if self.count == 1:
 			self.fm.move_right()
 			self.fm.block_input(0.5)
+
+	def quick_open(self):
+		self._search()
+		if self.count == 1:
 			return True
 
 	def _search(self):
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index 6562276f..29e8f1c5 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -50,6 +50,7 @@ class Console(Widget):
 	history = None
 	histories = None
 	override = None
+	allow_close = False
 
 	def __init__(self, win):
 		from ranger.container import CommandList, History
@@ -92,6 +93,7 @@ class Console(Widget):
 		self.__class__ = cls
 		self.history = self.histories[DEFAULT_HISTORY]
 		self.init()
+		self.allow_close = False
 		self.tab_deque = None
 		self.focused = True
 		self.visible = True
@@ -103,6 +105,7 @@ class Console(Widget):
 	def close(self):
 		curses.curs_set(self.last_cursor_mode)
 		self.add_to_history()
+		self.tab_deque = None
 		self.clear()
 		self.__class__ = Console
 		self.focused = False
@@ -215,8 +218,7 @@ class Console(Widget):
 		self.on_line_change()
 
 	def execute(self):
-		self.tab_deque = None
-		self.close()
+		pass
 
 	def tab(self):
 		pass
@@ -267,6 +269,7 @@ class CommandConsole(ConsoleWithTab):
 	prompt = ':'
 
 	def execute(self, cmd=None):
+		self.allow_close = True
 		if cmd is None:
 			cmd = self._get_cmd()
 
@@ -276,7 +279,8 @@ class CommandConsole(ConsoleWithTab):
 			except Exception as error:
 				self.fm.notify(error)
 
-		Console.execute(self)
+		if self.allow_close:
+			self.close()
 
 	def _get_cmd(self):
 		command_class = self._get_cmd_class()
@@ -344,7 +348,7 @@ class SearchConsole(Console):
 			self.fm.env.last_search = regexp
 			if self.fm.search(order='search'):
 				self.fm.env.cf = self.fm.env.pwd.pointed_obj
-		Console.execute(self)
+		self.close()
 
 
 class OpenConsole(ConsoleWithTab):
@@ -380,9 +384,8 @@ class OpenConsole(ConsoleWithTab):
 		if command:
 			if _CustomTemplate.delimiter in command:
 				command = self._substitute_metachars(command)
-			log(command)
 			self.fm.execute_command(command, flags=flags)
-		Console.execute(self)
+		self.close()
 
 	def _get_tab(self):
 		# for now, just add " %s"
@@ -446,7 +449,7 @@ class QuickOpenConsole(ConsoleWithTab):
 				app = app,
 				flags = flags,
 				mode = mode )
-		Console.execute(self)
+		self.close()
 
 	def _get_app_flags_mode(self):
 		"""
^
2a256611 ^
d3f9d547 ^


f7c3c4ca ^





e4409c40 ^
2a256611 ^
86b4d41a ^
d3f9d547 ^
e4409c40 ^
d4a8ec3c ^


d3f9d547 ^
e4409c40 ^
d3f9d547 ^
e4409c40 ^
d4a8ec3c ^
d3f9d547 ^
e4409c40 ^

549ec595 ^
e4409c40 ^
97d3287a ^
d3f9d547 ^
08fc6e5c ^
d97a6513 ^
d3f9d547 ^
e4409c40 ^
d3f9d547 ^

e4409c40 ^
d3f9d547 ^
86b4d41a ^
d4a8ec3c ^


29ee16d5 ^
d4a8ec3c ^
08fc6e5c ^
e4409c40 ^
c4e90d70 ^
8ce6b560 ^
d4a8ec3c ^
d3f9d547 ^
e4409c40 ^
d4a8ec3c ^
86b4d41a ^
d4a8ec3c ^


b6c832d0 ^
e4409c40 ^



d2e46bbf ^
e4409c40 ^
d4a8ec3c ^
97d3287a ^
18024037 ^
d3f9d547 ^
e4409c40 ^
d2e46bbf ^
e4409c40 ^
b6c832d0 ^
e4409c40 ^
d4a8ec3c ^

d2e46bbf ^
b6c832d0 ^
d4a8ec3c ^


e4409c40 ^


8f8c57cc ^
e4409c40 ^

c4e90d70 ^
d3f9d547 ^
55ebd12c ^

d2e46bbf ^
e4409c40 ^


c4e90d70 ^
e4409c40 ^

945e8eb6 ^
2a256611 ^
c4e90d70 ^
d3f9d547 ^
899516a7 ^
f7c3c4ca ^
d3f9d547 ^

e4409c40 ^
55ebd12c ^
c4e90d70 ^





8ce6b560 ^
e4409c40 ^
d3f9d547 ^
e4409c40 ^
d3f9d547 ^
e4409c40 ^

e4409c40 ^
8ce6b560 ^
d3f9d547 ^

8ce6b560 ^
e4409c40 ^


55ebd12c ^
e4409c40 ^

8f8c57cc ^
86b4d41a ^
55ebd12c ^
899516a7 ^
8f8c57cc ^
97d3287a ^
1a2ac66b ^
d3f9d547 ^

1a2ac66b ^
e4409c40 ^

8f8c57cc ^

e4409c40 ^

d3f9d547 ^
d4a8ec3c ^
97d3287a ^
d4a8ec3c ^
d3f9d547 ^

e4409c40 ^
d3f9d547 ^
0654c702 ^




e4409c40 ^
e4409c40 ^


e4409c40 ^
e4409c40 ^
e4409c40 ^
e4409c40 ^
e4409c40 ^

e4409c40 ^
d3f9d547 ^











e6ba2a01 ^
86b4d41a ^



97d3287a ^











2f5222ea ^
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224