diff options
-rw-r--r-- | README.md | 5 | ||||
-rw-r--r-- | doc/ranger.pod | 2 | ||||
-rw-r--r-- | ranger/config/rc.conf | 2 | ||||
-rwxr-xr-x | ranger/data/scope.sh | 3 | ||||
-rw-r--r-- | ranger/ext/shell_escape.py | 2 | ||||
-rw-r--r-- | ranger/gui/displayable.py | 6 | ||||
-rw-r--r-- | ranger/gui/ui.py | 14 | ||||
-rw-r--r-- | ranger/gui/widgets/statusbar.py | 2 | ||||
-rw-r--r-- | ranger/gui/widgets/view_miller.py | 5 |
9 files changed, 25 insertions, 16 deletions
diff --git a/README.md b/README.md index b5fc03ea..5174f1c1 100644 --- a/README.md +++ b/README.md @@ -69,12 +69,13 @@ Optional: Optional, for enhanced file previews (with "scope.sh"): * img2txt (from caca-utils) for ASCII-art image previews -* highlight for syntax highlighting of code -* atool for previews of archives +* highlight or pygmentize for syntax highlighting of code +* atool, acat, bsdtar and/or unrar for previews of archives * lynx, w3m or elinks for previews of html pages * pdftotext for pdf previews * transmission-show for viewing bit-torrent information * mediainfo or exiftool for viewing information about media files +* odt2txt for OpenDocument text files (odt, ods, odp and sxw) Installing diff --git a/doc/ranger.pod b/doc/ranger.pod index 7c5a7768..6b0752bd 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -1063,7 +1063,7 @@ Examples: =item filter [I<string>] Displays only the files which contain the I<string> in their basename. Running -this command without any parameter will reset the fitler. +this command without any parameter will reset the filter. This command is based on the I<scout> command and supports all of its options. diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 560fbe4d..cc7f5007 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -259,7 +259,7 @@ map ! console shell%space map @ console -p6 shell %%s map # console shell -p%space map s console shell%space -map r chain draw_possible_programs; console open_with%space +map r chain draw_possible_programs; console open_with%%space map f console find%space map cd console cd%space diff --git a/ranger/data/scope.sh b/ranger/data/scope.sh index 669d1e34..44fcec2b 100755 --- a/ranger/data/scope.sh +++ b/ranger/data/scope.sh @@ -80,6 +80,9 @@ case "$extension" in # BitTorrent Files torrent) try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;; + # ODT Files + odt|ods|odp|sxw) + try odt2txt "$path" && { dump | trim; exit 5; } || exit 1;; # HTML Pages: htm|html|xhtml) try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; } diff --git a/ranger/ext/shell_escape.py b/ranger/ext/shell_escape.py index fe542084..d57ff339 100644 --- a/ranger/ext/shell_escape.py +++ b/ranger/ext/shell_escape.py @@ -3,7 +3,7 @@ """Functions to escape metacharacters of arguments for shell commands.""" -META_CHARS = (' ', "'", '"', '`', '&', '|', ';', +META_CHARS = (' ', "'", '"', '`', '&', '|', ';', '#', '$', '!', '(', ')', '[', ']', '<', '>', '\t') UNESCAPABLE = set(map(chr, list(range(9)) + list(range(10, 32)) + list(range(127, 256)))) diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py index 7b5aa954..62eb5300 100644 --- a/ranger/gui/displayable.py +++ b/ranger/gui/displayable.py @@ -211,6 +211,7 @@ class DisplayableContainer(Displayable): New methods: add_child(object) -- add the object to the container. + replace_child(old_obj, new_obj) -- replaces old object with new object. remove_child(object) -- remove the object from the container. New attributes: @@ -290,6 +291,11 @@ class DisplayableContainer(Displayable): self.container.append(obj) obj.parent = self + def replace_child(self, old_obj, new_obj): + """Replace the old object with the new instance in the container.""" + self.container[self.container.index(old_obj)] = new_obj + new_obj.parent = self + def remove_child(self, obj): """Remove the object from the container.""" try: diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 4c302e00..f10bc0f2 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -437,18 +437,18 @@ class UI(DisplayableContainer): if value in self.ALLOWED_VIEWMODES: if self._viewmode != value: self._viewmode = value - resize = False + new_browser = self._viewmode_to_class(value)(self.win) + if hasattr(self, 'browser'): old_size = self.browser.y, self.browser.x, self.browser.hei, self.browser.wid - self.remove_child(self.browser) + self.replace_child(self.browser, new_browser) self.browser.destroy() - resize = True + new_browser.resize(*old_size) + else: + self.add_child(new_browser) - self.browser = self._viewmode_to_class(value)(self.win) + self.browser = new_browser self.redraw_window() - self.add_child(self.browser) - if resize: - self.browser.resize(*old_size) else: raise ValueError("Attempting to set invalid viewmode `%s`, should " "be one of `%s`." % (value, "`, `".join(self.ALLOWED_VIEWMODES))) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index 4eb06692..0828c372 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -258,7 +258,7 @@ class StatusBar(Widget): right.add("', ", "space") if target.marked_items: - if len(target.marked_items) == len(target.files): + if len(target.marked_items) == target.size: right.add(human_readable(target.disk_usage, separator='')) else: sumsize = sum(f.size for f in target.marked_items if not diff --git a/ranger/gui/widgets/view_miller.py b/ranger/gui/widgets/view_miller.py index 90046456..42013fe9 100644 --- a/ranger/gui/widgets/view_miller.py +++ b/ranger/gui/widgets/view_miller.py @@ -256,9 +256,8 @@ class ViewMiller(ViewBase): # Show the preview column when it has a preview but has # been hidden (e.g. because of padding_right = False) - if not self.pager.visible and not self.columns[-1].visible and \ - self.columns[-1].target and self.columns[-1].target.is_directory \ - or self.columns[-1].has_preview() and not self.pager.visible: + if not self.columns[-1].visible and self.columns[-1].has_preview() \ + and not self.pager.visible: self.columns[-1].visible = True if self.preview and self.is_collapsed != self._collapse(): |