summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--doc/ranger.pod5
-rw-r--r--ranger/config/commands.py3
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/core/environment.py2
-rw-r--r--ranger/ext/keybinding_parser.py20
7 files changed, 30 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 109d9f2a..0a79142e 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ SETUPOPTS ?= '--record=install_log.txt'
 DOCDIR ?= doc/pydoc
 DESTDIR ?= /
 PYOPTIMIZE ?= 1
+FILTER ?= .
 
 CWD = $(shell pwd)
 
@@ -60,7 +61,7 @@ doc: cleandoc
 	find . -name \*.html -exec sed -i 's|'$(CWD)'|../..|g' -- {} \;
 
 test:
-	@for FILE in $(shell grep -IHm 1 doctest -r ranger | cut -d: -f1); do \
+	@for FILE in $(shell grep -IHm 1 doctest -r ranger | grep $(FILTER) | cut -d: -f1); do \
 		echo "Testing $$FILE..."; \
 		RANGER_DOCTEST=1 PYTHONPATH=".:"$$PYTHONPATH ${PYTHON} $$FILE; \
 	done
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 713878f6..e7d8aaea 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -530,6 +530,11 @@ You can display the "real" cumulative size of directories by using the command
 will not be updated automatically.  You can choose to update it automatically
 though by turning on this option.
 
+=item cd_bookmarks [bool]
+
+Specify whether bookmarks should be included in the tab completion of the "cd"
+command.
+
 =item collapse_preview [bool] <zc>
 
 When no preview is visible, should the last column be squeezed to make use of
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 9fe2b2c8..68714009 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -154,7 +154,8 @@ class cd(Command):
             pass
         else:
             dirnames.sort()
-            dirnames = bookmarks + dirnames
+            if self.fm.settings.cd_bookmarks:
+                dirnames = bookmarks + dirnames
 
             # no results, return None
             if len(dirnames) == 0:
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index 37efb265..11a0ae15 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -156,6 +156,9 @@ set sort_directories_first true
 # (Especially on xterm)
 set xterm_alt_key false
 
+# whether to include bookmarks in cd command
+set cd_bookmarks true
+
 # ===================================================================
 # == Local Options
 # ===================================================================
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 58ddffc9..27fed711 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -53,6 +53,7 @@ ALLOWED_SETTINGS = {
     'vcs_backend_hg': str,
     'vcs_backend_bzr': str,
     'xterm_alt_key': bool,
+    'cd_bookmarks': bool,
 }
 
 DEFAULT_VALUES = {
diff --git a/ranger/core/environment.py b/ranger/core/environment.py
index 701870e1..562212d4 100644
--- a/ranger/core/environment.py
+++ b/ranger/core/environment.py
@@ -108,4 +108,4 @@ class Environment(SettingsAware, FileManagerAware, SignalDispatcher):
 
     def get_free_space(self, path):
         stat = os.statvfs(path)
-        return stat.f_bavail * stat.f_bsize
+        return stat.f_bavail * stat.f_frsize
diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py
index 0519f69f..d7b24be3 100644
--- a/ranger/ext/keybinding_parser.py
+++ b/ranger/ext/keybinding_parser.py
@@ -63,10 +63,18 @@ reversed_special_keys = dict((v, k) for k, v in special_keys.items())
 def parse_keybinding(obj):
     """Translate a keybinding to a sequence of integers
 
-    Example:
-    lol<CR>   =>   (ord('l'), ord('o'), ord('l'), ord('\\n'))
-              =>   (108, 111, 108, 10)
-    x<A-Left> =>   (120, (27, curses.KEY_LEFT))
+    >>> tuple(parse_keybinding("lol<CR>"))
+    (108, 111, 108, 10)
+
+    >>> out = tuple(parse_keybinding("x<A-Left>"))
+    >>> out  # it's kind of dumb that you cant test for constants...
+    (120, 9003, 260)
+    >>> out[0] == ord('x')
+    True
+    >>> out[1] == ALT_KEY
+    True
+    >>> out[2] == curses.KEY_LEFT
+    True
     """
     assert isinstance(obj, (tuple, int, str))
     if isinstance(obj, tuple):
@@ -249,3 +257,7 @@ class KeyBuffer(object):
 
     def __str__(self):
         return "".join(key_to_string(c) for c in self.keys)
+
+if __name__ == '__main__':
+    import doctest
+    doctest.testmod()