about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--ranger/container/bookmarks.py3
-rw-r--r--ranger/gui/widgets/browserview.py25
3 files changed, 30 insertions, 1 deletions
diff --git a/TODO b/TODO
index ccef8c6e..2b996543 100644
--- a/TODO
+++ b/TODO
@@ -19,9 +19,10 @@ General
    (X) #12  09/12/27  jump through the list in a specific order
    (X) #14  09/12/29  make filelists inherit from pagers
    (X) #15  09/12/29  better way of running processes!!~
-   ( ) #16  10/01/01  list of bookmarks
+   (X) #16  10/01/01  list of bookmarks
 
 
 Bugs
 
    ( ) #17  10/01/01  why do bookmarks disappear sometimes?
+   ( ) #18  10/01/01  fix notify widget (by adding a LogView?)
diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py
index b16180a0..2d58c1d8 100644
--- a/ranger/container/bookmarks.py
+++ b/ranger/container/bookmarks.py
@@ -65,6 +65,9 @@ class Bookmarks(object):
 		self["`"] = value
 		self["'"] = value
 		if self.autosave: self.save()
+	
+	def __iter__(self):
+		return iter(self.dct.items())
 
 	def __getitem__(self, key):
 		"""Get the bookmark associated with the key"""
diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py
index ffca34c6..488b7cfd 100644
--- a/ranger/gui/widgets/browserview.py
+++ b/ranger/gui/widgets/browserview.py
@@ -9,6 +9,7 @@ class BrowserView(Widget, DisplayableContainer):
 	preview = True
 	preview_available = True
 	stretch_ratios = None
+	need_clear = False
 
 	def __init__(self, win, ratios, preview = True):
 		DisplayableContainer.__init__(self, win)
@@ -42,6 +43,30 @@ class BrowserView(Widget, DisplayableContainer):
 
 		self.pager = Pager(self.win, embedded=True)
 		self.add_child(self.pager)
+
+	def draw(self):
+		if str(self.env.keybuffer) in ("`", "'"):
+			self._draw_bookmarks()
+		else:
+			if self.need_clear:
+				self.win.erase()
+				self.need_redraw = True
+				self.need_clear = False
+			DisplayableContainer.draw(self)
+	
+	def _draw_bookmarks(self):
+		self.need_clear = True
+
+		def generator():
+			return zip(range(self.hei), self.fm.bookmarks)
+
+		maxlen = max(len(item[1].path) for i, item in generator())
+		maxlen = min(maxlen + 5, self.wid)
+
+		for line, items in generator():
+			key, mark = items
+			string = " " + key + ": " + mark.path
+			self.addstr(line, 0, string.ljust(maxlen))
 	
 	def resize(self, y, x, hei, wid):
 		"""Resize all the columns according to the given ratio"""