summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-10-01 02:35:40 +0200
committerhut <hut@lavabit.com>2011-10-01 02:35:40 +0200
commitce6c90a0d88d60aa98b78ec5d072a2270c569d70 (patch)
tree0fbc9d2baf83fffad465f75307214fd26f705c32 /ranger
parent7c9e8e286e6bfe939fa492429144da56ab75cd03 (diff)
downloadranger-ce6c90a0d88d60aa98b78ec5d072a2270c569d70.tar.gz
gui.widgets.browserview: improved hint/bookmark list
Diffstat (limited to 'ranger')
-rw-r--r--ranger/core/actions.py4
-rw-r--r--ranger/defaults/rc.conf1
-rw-r--r--ranger/ext/keybinding_parser.py11
-rw-r--r--ranger/gui/widgets/browserview.py4
4 files changed, 12 insertions, 8 deletions
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 1904082e..42cb6747 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -24,7 +24,7 @@ from inspect import cleandoc
 import ranger
 from ranger.ext.direction import Direction
 from ranger.ext.relative_symlink import relative_symlink
-from ranger.ext.keybinding_parser import construct_keybinding
+from ranger.ext.keybinding_parser import key_to_string
 from ranger.ext.shell_escape import shell_quote
 from ranger import fsobject
 from ranger.core.shared import FileManagerAware, EnvironmentAware, \
@@ -102,7 +102,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
 		else:
 			cmd = cmd_class(string)
 			if cmd.resolve_macros and _MacroTemplate.delimiter in string:
-				macros = dict(('any%d'%i, construct_keybinding([char])) \
+				macros = dict(('any%d'%i, key_to_string(char)) \
 						for i, char in enumerate(wildcards))
 				if 'any0' in macros:
 					macros['any'] = macros['any0']
diff --git a/ranger/defaults/rc.conf b/ranger/defaults/rc.conf
index d56c90a9..a6fd6098 100644
--- a/ranger/defaults/rc.conf
+++ b/ranger/defaults/rc.conf
@@ -200,6 +200,7 @@ map zf    console filter
 # Bookmarks
 map `<bg>   draw_bookmarks
 map '<bg>   draw_bookmarks
+map m<bg>   draw_bookmarks
 map um<bg>  draw_bookmarks
 map `<any>  enter_bookmark %any
 map '<any>  enter_bookmark %any
diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py
index 4e590283..7dbf8c25 100644
--- a/ranger/ext/keybinding_parser.py
+++ b/ranger/ext/keybinding_parser.py
@@ -69,12 +69,15 @@ def construct_keybinding(iterable):
 	"""
 	result = []
 	for c in iterable:
-		try:
-			result.append(chr(c))
-		except:
-			result.append("?")
+		result.append(key_to_string(c))
 	return ''.join(result)
 
+def key_to_string(key):
+	try:
+		return chr(key)
+	except:
+		return '?'
+
 # Arbitrary numbers which are not used with curses.KEY_XYZ
 DIRKEY = 9001
 ANYKEY = 9002
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py
index c789a7d2..b7ec14c2 100644
--- a/ranger/gui/widgets/browserview.py
+++ b/ranger/gui/widgets/browserview.py
@@ -16,6 +16,7 @@
 """The BrowserView manages a set of BrowserColumns."""
 import curses
 from ranger.ext.signals import Signal
+from ranger.ext.keybinding_parser import key_to_string
 from . import Widget
 from .browsercolumn import BrowserColumn
 from .pager import Pager
@@ -181,8 +182,7 @@ class BrowserView(Widget, DisplayableContainer):
 		self.need_clear = True
 		hints = []
 		for k, v in self.fm.env.keybuffer.pointer.items():
-			try: k = chr(k)
-			except: k = str(k)
+			k = key_to_string(k)
 			if isinstance(v, dict):
 				text = '...'
 			else: