about 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/config/rifle.conf4
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/core/actions.py2
-rw-r--r--ranger/core/environment.py2
-rw-r--r--ranger/ext/keybinding_parser.py20
9 files changed, 35 insertions, 8 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/config/rifle.conf b/ranger/config/rifle.conf
index 9e29062a..364d7c28 100644
--- a/ranger/config/rifle.conf
+++ b/ranger/config/rifle.conf
@@ -104,6 +104,7 @@ ext php = php -- "$1"
 #-------------------------------------------
 mime ^audio|ogg$, terminal, has mplayer  = mplayer -- "$@"
 mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
+mime ^audio|ogg$, terminal, has mpv      = mpv -- "$@"
 ext midi?,        terminal, has wildmidi = wildmidi -- "$@"
 
 #--------------------------------------------
@@ -111,6 +112,8 @@ ext midi?,        terminal, has wildmidi = wildmidi -- "$@"
 #-------------------------------------------
 mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
 mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
+mime ^video,       has mpv,      X, flag f = mpv -- "$@"
+mime ^video,       has mpv,      X, flag f = mpv --fs -- "$@"
 mime ^video,       has mplayer2, X, flag f = mplayer2 -- "$@"
 mime ^video,       has mplayer2, X, flag f = mplayer2 -fs -- "$@"
 mime ^video,       has mplayer,  X, flag f = mplayer -- "$@"
@@ -122,6 +125,7 @@ mime ^video|audio, has totem,    X, flag f = totem --fullscreen -- "$@"
 #--------------------------------------------
 # Video without X:
 #-------------------------------------------
+mime ^video, terminal, !X, has mpv       = mpv -- "$@"
 mime ^video, terminal, !X, has mplayer2  = mplayer2 -- "$@"
 mime ^video, terminal, !X, has mplayer   = mplayer -- "$@"
 
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 29e6d729..f46acd38 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -54,6 +54,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/actions.py b/ranger/core/actions.py
index 67223258..eb9169a6 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -287,7 +287,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware):
     def source(self, filename):
         filename = os.path.expanduser(filename)
         for line in open(filename, 'r'):
-            line = line.rstrip("\r\n")
+            line = line.lstrip().rstrip("\r\n")
             if line.startswith("#") or not line.strip():
                 continue
             try:
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()