about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.112
-rw-r--r--doc/ranger.pod9
-rw-r--r--ranger/colorschemes/default.py3
-rw-r--r--ranger/colorschemes/jungle.py3
-rw-r--r--ranger/colorschemes/solarized.py3
-rw-r--r--ranger/container/file.py9
-rw-r--r--ranger/container/fsobject.py5
-rw-r--r--ranger/core/actions.py35
-rw-r--r--ranger/core/loader.py3
-rw-r--r--ranger/gui/ui.py1
-rw-r--r--ranger/gui/widgets/view_miller.py2
11 files changed, 64 insertions, 21 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index c8ff78eb..db608eaf 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -133,7 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.7.2" "04/03/2016" "ranger manual"
+.TH RANGER 1 "ranger-1.7.2" "04/15/2016" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -903,6 +903,7 @@ ranger.  For your convenience, this is a list of the \*(L"public\*(R" commands i
 \& setintag tags option value
 \& setlocal [path=<path>] option value
 \& shell [\-FLAGS] command
+\& source filename
 \& terminal
 \& tmap key command
 \& touch filename
@@ -1214,6 +1215,15 @@ use \f(CW\*(C`path=~/dl$\*(C'\fR.
 .IP "shell [\-\fIflags\fR] \fIcommand\fR" 2
 .IX Item "shell [-flags] command"
 Run a shell command.  \fIflags\fR are discussed in their own section.
+.IP "source \fIfilename\fR" 2
+.IX Item "source filename"
+Reads commands from a file and executes them in the ranger console.
+.Sp
+This can be used to re-evaluate the rc.conf file after changing it:
+.Sp
+.Vb 1
+\& map X chain shell vim \-p %confdir/rc.conf %rangerdir/config/rc.conf; source %confdir/rc.conf
+.Ve
 .IP "terminal" 2
 .IX Item "terminal"
 Spawns the \fIx\-terminal-emulator\fR starting in the current directory.
diff --git a/doc/ranger.pod b/doc/ranger.pod
index 6d798b5a..43b248ce 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -919,6 +919,7 @@ ranger.  For your convenience, this is a list of the "public" commands including
  setintag tags option value
  setlocal [path=<path>] option value
  shell [-FLAGS] command
+ source filename
  terminal
  tmap key command
  touch filename
@@ -1269,6 +1270,14 @@ use C<path=~/dl$>.
 
 Run a shell command.  I<flags> are discussed in their own section.
 
+=item source I<filename>
+
+Reads commands from a file and executes them in the ranger console.
+
+This can be used to re-evaluate the rc.conf file after changing it:
+
+ map X chain shell vim -p %confdir/rc.conf %rangerdir/config/rc.conf; source %confdir/rc.conf
+
 =item terminal
 
 Spawns the I<x-terminal-emulator> starting in the current directory.
diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py
index e5dbf3a6..37b372a3 100644
--- a/ranger/colorschemes/default.py
+++ b/ranger/colorschemes/default.py
@@ -67,6 +67,9 @@ class Default(ColorScheme):
                 else:
                     fg = magenta
 
+            if context.inactive_pane:
+                fg = cyan
+
         elif context.in_titlebar:
             attr |= bold
             if context.hostname:
diff --git a/ranger/colorschemes/jungle.py b/ranger/colorschemes/jungle.py
index a4fb1c1d..6a9c3c52 100644
--- a/ranger/colorschemes/jungle.py
+++ b/ranger/colorschemes/jungle.py
@@ -9,7 +9,8 @@ class Scheme(Default):
     def use(self, context):
         fg, bg, attr = Default.use(self, context)
 
-        if context.directory and not context.marked and not context.link:
+        if context.directory and not context.marked and not context.link \
+                and not context.inactive_pane:
             fg = green
 
         if context.in_titlebar and context.hostname:
diff --git a/ranger/colorschemes/solarized.py b/ranger/colorschemes/solarized.py
index 07552ce2..2177ca3d 100644
--- a/ranger/colorschemes/solarized.py
+++ b/ranger/colorschemes/solarized.py
@@ -80,6 +80,9 @@ class Solarized(ColorScheme):
                 else:
                     fg = magenta
 
+            if context.inactive_pane:
+                fg = 241
+
         elif context.in_titlebar:
             attr |= bold
             if context.hostname:
diff --git a/ranger/container/file.py b/ranger/container/file.py
index a3db63a5..2c6d8315 100644
--- a/ranger/container/file.py
+++ b/ranger/container/file.py
@@ -96,3 +96,12 @@ class File(FileSystemObject):
             return self.fm.previews[self.realpath]['imagepreview']
         except KeyError:
             return False
+
+    def __eq__(self, other):
+        return isinstance(other, File) and self.path == other.path
+
+    def __neq__(self, other):
+        return not self.__eq__(other)
+
+    def __hash__(self):
+        return hash(self.path)
diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py
index 10f8259d..fff29c36 100644
--- a/ranger/container/fsobject.py
+++ b/ranger/container/fsobject.py
@@ -31,6 +31,7 @@ else:
 _unsafe_chars = '\n' + ''.join(map(chr, range(32))) + ''.join(map(chr, range(128, 256)))
 _safe_string_table = maketrans(_unsafe_chars, '?' * len(_unsafe_chars))
 _extract_number_re = re.compile(r'(\d+|\D)')
+_integers = set("0123456789")
 
 def safe_path(path):
     return path.translate(_safe_string_table)
@@ -135,12 +136,12 @@ class FileSystemObject(FileManagerAware, SettingsAware):
 
     @lazy_property
     def basename_natural(self):
-        return [('0', int(s)) if s.isdigit() else (s, 0) \
+        return [('0', int(s)) if s in _integers else (s, 0) \
                 for s in _extract_number_re.split(self.relative_path)]
 
     @lazy_property
     def basename_natural_lower(self):
-        return [('0', int(s)) if s.isdigit() else (s, 0) \
+        return [('0', int(s)) if s in _integers else (s, 0) \
                 for s in _extract_number_re.split(self.relative_path_lower)]
 
     @lazy_property
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 3b1fc47a..0224db6d 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -343,18 +343,19 @@ class Actions(FileManagerAware, SettingsAware):
         Load a config file.
         """
         filename = os.path.expanduser(filename)
-        for line in open(filename, 'r'):
-            line = line.lstrip().rstrip("\r\n")
-            if line.startswith("#") or not line.strip():
-                continue
-            try:
-                self.execute_console(line)
-            except Exception as e:
-                if ranger.arg.debug:
-                    raise
-                else:
-                    self.notify('Error in line `%s\':\n  %s' %
-                            (line, str(e)), bad=True)
+        with open(filename, 'r') as f:
+            for line in f:
+                line = line.lstrip().rstrip("\r\n")
+                if line.startswith("#") or not line.strip():
+                    continue
+                try:
+                    self.execute_console(line)
+                except Exception as e:
+                    if ranger.arg.debug:
+                        raise
+                    else:
+                        self.notify('Error in line `%s\':\n  %s' %
+                                (line, str(e)), bad=True)
 
     def execute_file(self, files, **kw):
         """Uses the "rifle" module to open/execute a file
@@ -821,9 +822,13 @@ class Actions(FileManagerAware, SettingsAware):
         except:
             self.ui.browser.draw_info = []
             return
-        programs = self.rifle.list_commands([target.path], None)
-        programs = ['%s | %s' % program[0:2] for program in programs]
-        self.ui.browser.draw_info = programs
+        programs = [program for program in self.rifle.list_commands([target.path],
+                None)]
+        if programs:
+            num_digits = max((len(str(program[0])) for program in programs))
+            program_info = ['%s | %s' % (str(program[0]).rjust(num_digits),
+                    program[1]) for program in programs]
+            self.ui.browser.draw_info = program_info
 
     def hide_console_info(self):
         self.ui.browser.draw_info = False
diff --git a/ranger/core/loader.py b/ranger/core/loader.py
index 2184d2b1..b1aabb53 100644
--- a/ranger/core/loader.py
+++ b/ranger/core/loader.py
@@ -260,7 +260,8 @@ def safeDecode(string):
         return string.decode("utf-8")
     except (UnicodeDecodeError):
         if HAVE_CHARDET:
-            return string.decode(chardet.detect(string)["encoding"])
+            codec = chardet.detect(string)["encoding"]
+            return string.decode(codec, 'ignore')
         else:
             return ""
 
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 14d6f247..e5833839 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -441,6 +441,7 @@ class UI(DisplayableContainer):
                     resize = True
 
                 self.browser = self._viewmode_to_class(value)(self.win)
+                self.redraw_window()
                 self.add_child(self.browser)
                 if resize:
                     self.browser.resize(*old_size)
diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py
index b34cc579..dbf59ff8 100644
--- a/ranger/gui/widgets/view_miller.py
+++ b/ranger/gui/widgets/view_miller.py
@@ -203,7 +203,7 @@ class ViewMiller(ViewBase):
                 if not cut_off:
                     wid = int(self.wid - left + 1 - pad)
                 else:
-                    self.columns[i].resize(pad, left - 1, hei - pad * 2, 1)
+                    self.columns[i].resize(pad, max(0, left - 1), hei - pad * 2, 1)
                     self.columns[i].visible = False
                     continue