summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-04-13 12:58:02 +0200
committerhut <hut@lavabit.com>2010-04-13 12:58:02 +0200
commitbcbb7832e669ee5554cf2bbecc8c97f2d18cf27b (patch)
tree018847529c4f6bc80b88cd9f13a566ca04fb7166
parentbec7df57bbf04c8798328cd3b45db2d6c9e54f95 (diff)
parentcf8b174eff6a9e016903d1071289453c8d9407d5 (diff)
downloadranger-bcbb7832e669ee5554cf2bbecc8c97f2d18cf27b.tar.gz
Merge branch 'master' into newkey
Conflicts:
	ranger/defaults/keys.py
-rw-r--r--TODO2
-rw-r--r--ranger/defaults/commands.py8
-rw-r--r--ranger/defaults/keys.py6
-rw-r--r--ranger/ext/command_parser.py21
-rw-r--r--ranger/gui/widgets/console.py1
5 files changed, 31 insertions, 7 deletions
diff --git a/TODO b/TODO
index d715c991..6be34f8c 100644
--- a/TODO
+++ b/TODO
@@ -49,7 +49,7 @@ General
    (X) #66  10/02/28  explain how colorschemes work
    (X) #70  10/03/14  mouse handler for titlebar
    (X) #71  10/03/21  previews: black/whitelist + read file
-   ( ) #79  10/04/08  tab number zero
+   (X) #79  10/04/08  tab number zero
    ( ) #80  10/04/08  when closing tabs, avoid gaps?
 
 
diff --git a/ranger/defaults/commands.py b/ranger/defaults/commands.py
index c5c47340..03fa1634 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/defaults/keys.py b/ranger/defaults/keys.py
index 80985274..b298f9c0 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -23,7 +23,7 @@ fnc is a function which is called with the CommandArgs object.
 
 The CommandArgs object has these attributes:
 arg.fm: the file manager instance
-arg.wdg: the widget or ui instance
+arg.wdg: the current widget
 arg.n: the number typed before the key combination (if allowed)
 arg.direction: the direction object (if applicable)
 arg.keys: the string representation of the used key combination
@@ -117,6 +117,10 @@ map.merge(vim_aliases)
 map('gg', fm.move(to=0))
 map('<C-D>', 'J', fm.move(down=0.5, pages=True))
 map('<C-U>', 'K', fm.move(up=0.5, pages=True))
+map(']', fm.move_parent(1))
+map('[', fm.move_parent(-1))
+map('}', fm.traverse())
+map('{', fm.history_go(-1))
 
 # --------------------------------------------------------- history
 map('H', fm.history_go(-1))
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
diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py
index a27e1956..3228c511 100644
--- a/ranger/gui/widgets/console.py
+++ b/ranger/gui/widgets/console.py
@@ -29,7 +29,6 @@ from ranger import log, relpath_conf
 from ranger.ext.shell_escape import shell_quote
 from ranger.container.keymap import CommandArgs
 from ranger.ext.get_executables import get_executables
-from ranger.ext.direction import Direction
 import ranger
 
 DEFAULT_HISTORY = 0