summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--examples/rc_emacs.conf1
-rw-r--r--ranger/config/commands.py14
-rw-r--r--ranger/config/rifle.conf5
-rw-r--r--ranger/core/fm.py7
-rw-r--r--ranger/core/loader.py10
-rwxr-xr-xranger/ext/rifle.py7
-rw-r--r--ranger/gui/colorscheme.py2
-rw-r--r--ranger/gui/curses_shortcuts.py8
-rw-r--r--ranger/gui/widgets/__init__.py2
-rw-r--r--ranger/gui/widgets/browsercolumn.py7
-rw-r--r--ranger/gui/widgets/titlebar.py4
11 files changed, 45 insertions, 22 deletions
diff --git a/examples/rc_emacs.conf b/examples/rc_emacs.conf
index e8b76ff2..f5e66b89 100644
--- a/examples/rc_emacs.conf
+++ b/examples/rc_emacs.conf
@@ -419,7 +419,6 @@ eval for arg in "rwxXst": cmd("map <C-x>-{0}  shell -f chmod u-{0} %s".format(ar
 
 # Search for letters as you type them
 #eval for arg in "abcdefghijklmnopqrstuvwxyz": cmd("map {0} console search_inc {0}".format(arg))
-map <allow_quantifiers> false
 
 # ===================================================================
 # == Define keys for the console
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 9f0481ce..4f7f109a 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -226,7 +226,7 @@ class shell(Command):
         else:
             before_word, start_of_word = self.line.rsplit(' ', 1)
             return (before_word + ' ' + file.shell_escaped_basename \
-                    for file in self.fm.thisdir.files \
+                    for file in self.fm.thisdir.files or [] \
                     if file.shell_escaped_basename.startswith(start_of_word))
 
 class open_with(Command):
@@ -342,12 +342,12 @@ class set_(Command):
         if not name:
             return sorted(self.firstpart + setting for setting in settings)
         if not value and not name_done:
-            return (self.firstpart + setting for setting in settings \
+            return sorted(self.firstpart + setting for setting in settings \
                     if setting.startswith(name))
         if not value:
             # Cycle through colorschemes when name, but no value is specified
             if name == "colorscheme":
-                return (self.firstpart + colorscheme for colorscheme \
+                return sorted(self.firstpart + colorscheme for colorscheme \
                         in get_all_colorschemes())
             return self.firstpart + str(settings[name])
         if bool in settings.types_of(name):
@@ -357,7 +357,7 @@ class set_(Command):
                 return self.firstpart + 'False'
         # Tab complete colorscheme values if incomplete value is present
         if name == "colorscheme":
-            return (self.firstpart + colorscheme for colorscheme \
+            return sorted(self.firstpart + colorscheme for colorscheme \
                     in get_all_colorschemes() if colorscheme.startswith(value))
 
 
@@ -548,7 +548,7 @@ class mark_tag(Command):
     def execute(self):
         cwd = self.fm.thisdir
         tags = self.rest(1).replace(" ","")
-        if not self.fm.tags:
+        if not self.fm.tags or not cwd.files:
             return
         for fileobj in cwd.files:
             try:
@@ -1131,7 +1131,7 @@ class scout(Command):
         self.fm.thistab.last_search = regex
         self.fm.set_search_method(order="search")
 
-        if self.MARK in flags or self.UNMARK in flags:
+        if (self.MARK in flags or self.UNMARK in flags) and thisdir.files:
             value = flags.find(self.MARK) > flags.find(self.UNMARK)
             if self.FILTER in flags:
                 for f in thisdir.files:
@@ -1234,7 +1234,7 @@ class scout(Command):
         cwd     = self.fm.thisdir
         pattern = self.pattern
 
-        if not pattern:
+        if not pattern or not cwd.files:
             return 0
         if pattern == '.':
             return 0
diff --git a/ranger/config/rifle.conf b/ranger/config/rifle.conf
index 76a3f4f3..31db35a4 100644
--- a/ranger/config/rifle.conf
+++ b/ranger/config/rifle.conf
@@ -57,6 +57,7 @@
 ext x?html?, has surf,           X, flag f = surf -- file://"$1"
 ext x?html?, has vimprobable,    X, flag f = vimprobable -- "$@"
 ext x?html?, has vimprobable2,   X, flag f = vimprobable2 -- "$@"
+ext x?html?, has qutebrowser,    X, flag f = qutebrowser -- "$@"
 ext x?html?, has dwb,            X, flag f = dwb -- "$@"
 ext x?html?, has jumanji,        X, flag f = jumanji -- "$@"
 ext x?html?, has luakit,         X, flag f = luakit -- "$@"
@@ -107,9 +108,9 @@ ext php = php -- "$1"
 #--------------------------------------------
 # Audio without X
 #-------------------------------------------
-mime ^audio|ogg$, terminal, has mplayer  = mplayer -- "$@"
-mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
 mime ^audio|ogg$, terminal, has mpv      = mpv -- "$@"
+mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
+mime ^audio|ogg$, terminal, has mplayer  = mplayer -- "$@"
 ext midi?,        terminal, has wildmidi = wildmidi -- "$@"
 
 #--------------------------------------------
diff --git a/ranger/core/fm.py b/ranger/core/fm.py
index 0313639a..046eb788 100644
--- a/ranger/core/fm.py
+++ b/ranger/core/fm.py
@@ -136,7 +136,7 @@ class FM(Actions, SignalDispatcher):
 
             if self.settings.open_all_images and \
                     len(self.thisdir.marked_items) == 0 and \
-                    re.match(r'^(feh|sxiv) ', command):
+                    re.match(r'^(feh|sxiv|imv) ', command):
 
                 images = [f.relative_path for f in self.thisdir.files if f.image]
                 escaped_filenames = " ".join(shell_quote(f) \
@@ -156,6 +156,11 @@ class FM(Actions, SignalDispatcher):
                             "feh --start-at %s " % \
                             shell_quote(self.thisfile.relative_path), 1)
 
+                    if command[0:4] == 'imv ':
+                        number = images.index(self.thisfile.relative_path) + 1
+                        new_command = command.replace("imv ",
+                                "imv -n %d " % number, 1)
+
                     if new_command:
                         command = "set -- %s; %s" % (escaped_filenames,
                                 new_command)
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 411b16ec..2184d2b1 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -6,6 +6,7 @@ from time import time, sleep
 from subprocess import Popen, PIPE
 from ranger.core.shared import FileManagerAware
 from ranger.ext.signals import SignalDispatcher
+from ranger.ext.human_readable import human_readable
 import math
 import os.path
 import sys
@@ -77,13 +78,14 @@ class CopyLoader(Loadable, FileManagerAware):
             # TODO: Don't calculate size when renaming (needs detection)
             bytes_per_tick = shutil_g.BLOCK_SIZE
             size = max(1, self._calculate_size(bytes_per_tick))
+            size_str = " (" + human_readable(self._calculate_size(1)) + ")"
             done = 0
             if self.do_cut:
                 self.original_copy_buffer.clear()
                 if len(self.copy_buffer) == 1:
-                    self.description = "moving: " + self.one_file.path
+                    self.description = "moving: " + self.one_file.path + size_str
                 else:
-                    self.description = "moving files from: " + self.one_file.dirname
+                    self.description = "moving files from: " + self.one_file.dirname + size_str
                 for f in self.copy_buffer:
                     for tf in self.fm.tags.tags:
                         if tf == f.path or str(tf).startswith(f.path):
@@ -101,9 +103,9 @@ class CopyLoader(Loadable, FileManagerAware):
                     done += d
             else:
                 if len(self.copy_buffer) == 1:
-                    self.description = "copying: " + self.one_file.path
+                    self.description = "copying: " + self.one_file.path + size_str
                 else:
-                    self.description = "copying files from: " + self.one_file.dirname
+                    self.description = "copying files from: " + self.one_file.dirname + size_str
                 for f in self.copy_buffer:
                     if os.path.isdir(f.path) and not os.path.islink(f.path):
                         d = 0
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index 5d13a5bf..c43de24f 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -195,8 +195,11 @@ class Rifle(object):
         argument = rule[1] if len(rule) > 1 else ''
 
         if function == 'ext':
-            extension = os.path.basename(files[0]).rsplit('.', 1)[-1].lower()
-            return bool(re.search('^(' + argument + ')$', extension))
+            if os.path.isfile(files[0]):
+                partitions = os.path.basename(files[0]).rpartition('.')
+                if not partitions[0]:
+                    return False
+                return bool(re.search('^(' + argument + ')$', partitions[2].lower()))
         elif function == 'name':
             return bool(re.search(argument, os.path.basename(files[0])))
         elif function == 'match':
diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py
index d6afcacc..d2b3b2d2 100644
--- a/ranger/gui/colorscheme.py
+++ b/ranger/gui/colorscheme.py
@@ -86,7 +86,7 @@ def _colorscheme_name_to_class(signal):
     usecustom = not ranger.arg.clean
 
     def exists(colorscheme):
-        return os.path.exists(colorscheme + '.py')
+        return os.path.exists(colorscheme + '.py') or os.path.exists(colorscheme + '.pyc')
 
     def is_scheme(x):
         try:
diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py
index 187891c6..e7573f17 100644
--- a/ranger/gui/curses_shortcuts.py
+++ b/ranger/gui/curses_shortcuts.py
@@ -25,20 +25,28 @@ class CursesShortcuts(SettingsAware):
     """
 
     def addstr(self, *args):
+        y, x = self.win.getyx()
+
         try:
             self.win.addstr(*args)
         except:
             if len(args) > 1:
+                self.win.move(y, x)
+
                 try:
                     self.win.addstr(*_fix_surrogates(args))
                 except:
                     pass
 
     def addnstr(self, *args):
+        y, x = self.win.getyx()
+
         try:
             self.win.addnstr(*args)
         except:
             if len(args) > 2:
+                self.win.move(y, x)
+
                 try:
                     self.win.addnstr(*_fix_surrogates(args))
                 except:
diff --git a/ranger/gui/widgets/__init__.py b/ranger/gui/widgets/__init__.py
index f2e52c0a..bd0f2337 100644
--- a/ranger/gui/widgets/__init__.py
+++ b/ranger/gui/widgets/__init__.py
@@ -21,3 +21,5 @@ class Widget(Displayable):
                 'ahead':    ('>', ["vcsahead"]),
                 'diverged': ('Y', ["vcsdiverged"]),
                 'unknown':  ('?', ["vcsunknown"])}
+
+    ellipsis = { False: '~', True: '…' }
diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py
index b38d0b5b..52ef62b8 100644
--- a/ranger/gui/widgets/browsercolumn.py
+++ b/ranger/gui/widgets/browsercolumn.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
 # This file is part of ranger, the console file manager.
 # License: GNU GPL version 3, see the file "AUTHORS" for details.
 
@@ -7,6 +6,7 @@
 import curses
 import stat
 from time import time
+from os.path import splitext
 
 from . import Widget
 from .pager import Pager
@@ -23,7 +23,6 @@ class BrowserColumn(Pager):
     scroll_begin = 0
     target = None
     last_redraw_time = -1
-    ellipsis = { False: '~', True: '…' }
 
     old_dir = None
     old_thisfile = None
@@ -342,8 +341,12 @@ class BrowserColumn(Pager):
 
     def _draw_text_display(self, text, space):
         wtext = WideString(text)
+        wext = WideString(splitext(text)[1])
         wellip = WideString(self.ellipsis[self.settings.unicode_ellipsis])
         if len(wtext) > space:
+            wtext = wtext[:max(1, space - len(wext) - len(wellip))] + wellip + wext
+        # Truncate again if still too long.
+        if len(wtext) > space:
             wtext = wtext[:max(0, space - len(wellip))] + wellip
 
         return [[str(wtext), []]]
diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py
index c3785986..dbd08981 100644
--- a/ranger/gui/widgets/titlebar.py
+++ b/ranger/gui/widgets/titlebar.py
@@ -98,7 +98,7 @@ class TitleBar(Widget):
         bar.add(self.fm.username, 'hostname', clr, fixed=True)
         bar.add('@', 'hostname', clr, fixed=True)
         bar.add(self.fm.hostname, 'hostname', clr, fixed=True)
-        bar.add(':', 'hostname', clr, fixed=True)
+        bar.add(' ', 'hostname', clr, fixed=True)
 
         pathway = self.fm.thistab.pathway
         if self.settings.tilde_in_titlebar and \
@@ -140,7 +140,7 @@ class TitleBar(Widget):
             if not dirname:
                 result += ":/"
             elif len(dirname) > 15:
-                result += ":" + dirname[:14] + "~"
+                result += ":" + dirname[:14] + self.ellipsis[self.settings.unicode_ellipsis]
             else:
                 result += ":" + dirname
         return result