summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-12 18:21:10 +0200
committerhut <hut@lavabit.com>2010-04-12 18:21:10 +0200
commit854c529e090bb61b886e1334af8c4aad096038dd (patch)
tree89c2cc192070f70c6ebc7582507fc446b712e626
parent1019737b2570cebd09a2cdff29642085aa6d062e (diff)
parenta9481b26a4c33daff7750aadfc6738bd9630f866 (diff)
downloadranger-854c529e090bb61b886e1334af8c4aad096038dd.tar.gz
Merge branch 'master' of ssh://repo.or.cz/srv/git/ranger
-rw-r--r--ranger/defaults/commands.py8
-rw-r--r--ranger/ext/command_parser.py21
2 files changed, 25 insertions, 4 deletions
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index 4b2d1c8f..e69dcf90 100644
--- a/ranger/defaults/commands.py
+++ b/ranger/defaults/commands.py
@@ -79,11 +79,11 @@ class Command(FileManagerAware):
 
 			# one result. since it must be a directory, append a slash.
 			if len(dirnames) == 1:
-				return line + join(rel_dirname, dirnames[0]) + '/'
+				return line.start(1) + join(rel_dirname, dirnames[0]) + '/'
 
 			# more than one result. append no slash, so the user can
 			# manually type in the slash to advance into that directory
-			return (line + join(rel_dirname, dirname) for dirname in dirnames)
+			return (line.start(1) + join(rel_dirname, dirname) for dirname in dirnames)
 
 	def _tab_directory_content(self):
 		from os.path import dirname, basename, expanduser, join, isdir
@@ -129,11 +129,11 @@ class Command(FileManagerAware):
 
 			# one result. since it must be a directory, append a slash.
 			if len(names) == 1:
-				return line + join(rel_dirname, names[0]) + '/'
+				return line.start(1) + join(rel_dirname, names[0]) + '/'
 
 			# more than one result. append no slash, so the user can
 			# manually type in the slash to advance into that directory
-			return (line + join(rel_dirname, name) for name in names)
+			return (line.start(1) + join(rel_dirname, name) for name in names)
 
 
 # -------------------------------- definitions
diff --git a/ranger/ext/command_parser.py b/ranger/ext/command_parser.py
index 3a676e8f..d737c277 100644
--- a/ranger/ext/command_parser.py
+++ b/ranger/ext/command_parser.py
@@ -25,6 +25,7 @@ class LazyParser(object):
 		self._setting_line = None
 		self._rests_loaded = 0
 		self._rests_gen_instance = None
+		self._starts = None
 
 		try:
 			self.firstpart = line[:line.rindex(' ') + 1]
@@ -52,6 +53,26 @@ class LazyParser(object):
 		else:
 			return otherwise
 
+	def start(self, n):
+		if self._starts is None:
+			self._starts = ['']
+			line = self.line
+			result = ""
+			while True:
+				try:
+					index = line.index(' ') + 1
+				except:
+					break
+				if index == 1:
+					continue
+				result = line[:index]
+				self._starts.append(result)
+				line = line[index:]
+		try:
+			return self._starts[n]
+		except:
+			return self._starts[-1]
+
 	def _rest_generator(self):
 		lastrest = self.line
 		n = 0
=2ca2e862e616eba862ac80f5ee0003d1aa984a32'>^
f07bb12f ^
4c13e1f2 ^


f07bb12f ^


4c13e1f2 ^

c9383c72 ^
f07bb12f ^
4c13e1f2 ^


f07bb12f ^
4c13e1f2 ^


f07bb12f ^










c9383c72 ^
f07bb12f ^


a614f048 ^
f07bb12f ^


c9383c72 ^
f07bb12f ^


c9383c72 ^

f07bb12f ^

















f07bb12f ^

4c13e1f2 ^
f07bb12f ^


4c13e1f2 ^
f07bb12f ^


4c13e1f2 ^
f07bb12f ^


62cd83ba ^

f07bb12f ^




4c13e1f2 ^
f07bb12f ^
4c13e1f2 ^

f07bb12f ^



f07bb12f ^















4c13e1f2 ^




34a60763 ^
4c13e1f2 ^
34a60763 ^
4c13e1f2 ^



f07bb12f ^
62cd83ba ^
f07bb12f ^
c9383c72 ^
f07bb12f ^
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