diff options
author | hut <hut@lavabit.com> | 2013-02-22 04:46:09 +0100 |
---|---|---|
committer | hut <hut@lavabit.com> | 2013-02-22 04:46:09 +0100 |
commit | bf6a3d6d6c11a85c37322e713b3c7a6eb2a484fc (patch) | |
tree | 776b05d2e7ed9ae03a3fb1115b8ae023e5bebbdd | |
parent | 4d48d33ca5529464dadbb2fc70888da4cd9d24fa (diff) | |
parent | c1138eb006c6daaa9b88204b0695f18d55e027dc (diff) | |
download | ranger-bf6a3d6d6c11a85c37322e713b3c7a6eb2a484fc.tar.gz |
Merge branch 'master' into vcs
Conflicts: ranger/gui/widgets/browsercolumn.py
68 files changed, 242 insertions, 218 deletions
diff --git a/Makefile b/Makefile index 2a4975ce..dca20caa 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. NAME = ranger diff --git a/README b/README index f5057a01..f1708257 100644 --- a/README +++ b/README @@ -2,14 +2,16 @@ ranger v.1.5.5 ============== ranger is a console file manager with VI key bindings. It provides a minimalistic and nice curses interface with a view on the directory hierarchy. -The secondary task of ranger is to figure out which program you want to use to -open your files with. +It ships with "rifle", a file launcher that is good at automatically finding +out which program to use for what file type. This file describes ranger and how to get it to run. For instructions on the usage, please read the man page. See doc/HACKING for development specific information. For configuration, check the files in ranger/config/. They are usually installed to /usr/lib/python*/site-packages/ranger/config/ -and can be obtained with ranger's --copy-config option. +and can be obtained with ranger's --copy-config option. The examples/ +directory contains several scripts and plugins that demonstrate how ranger can +be extended or combined with other programs. A note to packagers: Versions meant for packaging are listed in the changelog on the website. @@ -60,13 +62,13 @@ Optional: * w3m for the "w3mimgdisplay" program to preview images Optional, for enhanced file previews (with "scope.sh"): -* img2txt (from caca-utils) for previewing images +* img2txt (from caca-utils) for ASCII-art image previews * highlight for syntax highlighting of code * atool 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 for viewing information about media files +* mediainfo or exiftool for viewing information about media files Installing diff --git a/doc/HACKING b/doc/HACKING index 72dc94bc..36320b71 100644 --- a/doc/HACKING +++ b/doc/HACKING @@ -18,7 +18,7 @@ Patches Send patches, created with "git format-patch", to the email adress - romanz@lavabit.com + hut@lavabit.com If you plan to do major changes, or many changes over time, I encourage you to create a fork on GitHub, Gitorious or any other site. diff --git a/doc/ranger.1 b/doc/ranger.1 index 663b786a..6c30d19f 100644 --- a/doc/ranger.1 +++ b/doc/ranger.1 @@ -124,7 +124,7 @@ .\" ======================================================================== .\" .IX Title "RANGER 1" -.TH RANGER 1 "ranger-1.5.5" "02/18/2013" "ranger manual" +.TH RANGER 1 "ranger-1.5.5" "02/22/2013" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l @@ -226,7 +226,7 @@ typing \fI"<tagname>\fR. .SS "\s-1PREVIEWS\s0" .IX Subsection "PREVIEWS" By default, only text files are previewed, but you can enable external preview -scripts by setting the option \f(CW\*(C`use_preview_script\*(C'\fR and \f(CW\*(C`preview_files\*(C'\fR to True. +scripts by setting the option \f(CW\*(C`use_preview_script\*(C'\fR and \f(CW\*(C`preview_files\*(C'\fR to true. .PP This default script is \fI~/.config/ranger/scope.sh\fR. It contains more documentation and calls to the programs \fIlynx\fR and \fIelinks\fR for html, @@ -235,6 +235,14 @@ documentation and calls to the programs \fIlynx\fR and \fIelinks\fR for html, .PP Install these programs (just the ones you need) and scope.sh will automatically use them. +.PP +Independently of the preview script, there is a feature to preview images +by drawing them directly into the terminal. This does not work over ssh, +requires certain terminals (tested on \*(L"xterm\*(R" and \*(L"urxvt\*(R") and is incompatible +with tmux, although it works with screen. +.PP +To enable this feature, install the program \*(L"w3m\*(R" and set the option +\&\f(CW\*(C`preview_images\*(C'\fR to true. .SS "\s-1SELECTION\s0" .IX Subsection "SELECTION" The \fIselection\fR is defined as \*(L"All marked files \s-1IF\s0 \s-1THERE\s0 \s-1ARE\s0 \s-1ANY\s0, otherwise @@ -270,6 +278,10 @@ are in different directories: .PP Macros for file paths are generally shell-escaped so they can be used in the \&\f(CW\*(C`shell\*(C'\fR command. +.PP +Additionally, if you create a key binding that uses <any>, a special statement +which accepts any key, then the macro \f(CW%any\fR (or \f(CW%any0\fR, \f(CW%any1\fR, \f(CW%any2\fR, ...) can be +used in the command to get the key that was pressed. .SS "\s-1BOOKMARKS\s0" .IX Subsection "BOOKMARKS" Type \fBm<key>\fR to bookmark the current directory. You can re-enter this @@ -390,30 +402,42 @@ Reload everything .IP "^L" 14 .IX Item "^L" Redraw the screen +.IP "i" 14 +.IX Item "i" +Display the current file in a bigger window. +.IP "E" 14 +.IX Item "E" +Edit the current file in \f(CW$EDITOR\fR (\*(L"nano\*(R" by default) .IP "S" 14 .IX Item "S" Open a shell in the current directory .IP "?" 14 Opens this man page +.IP "<octal>=, +<who><what>, \-<who><what>" 14 +.IX Item "<octal>=, +<who><what>, -<who><what>" +Change the permissions of the selection. For example, \f(CW\*(C`777=\*(C'\fR is equivalent to +\&\f(CW\*(C`chmod 777 %s\*(C'\fR, \f(CW\*(C`+ar\*(C'\fR does \f(CW\*(C`chmod a+r %s\*(C'\fR, \f(CW\*(C`\-ow\*(C'\fR does \f(CW\*(C`chmod o\-w %s\*(C'\fR etc. .IP "yy" 14 .IX Item "yy" -Yank the selection to the \*(L"copy\*(R" buffer and mark them as to be copied +Copy (yank) the selection, like pressing Ctrl+C in modern \s-1GUI\s0 programs. .IP "dd" 14 .IX Item "dd" -Cut the selection to the \*(L"copy\*(R" buffer and mark them as to be moved +Cut the selection, like pressing Ctrl+X in modern \s-1GUI\s0 programs. .IP "pp" 14 .IX Item "pp" -Paste the files from the \*(L"copy\*(R" buffer here (by moving or copying, depending on -how they are marked.) By default, this will not overwrite existing files. To -overwrite them, use \fIpo\fR. +Paste the files which were previously copied or cut, like pressing Ctrl+V in +modern \s-1GUI\s0 programs. +.IP "po" 14 +.IX Item "po" +Paste the copied/cut files, overwriting existing files. .IP "m\fIX\fR" 14 .IX Item "mX" Create a bookmark with the name \fIX\fR .IP "`\fIX\fR" 14 .IX Item "`X" Move to the bookmark with the name \fIX\fR -.IP "n, N" 14 -.IX Item "n, N" +.IP "n" 14 +.IX Item "n" Find the next file. By default, this gets you to the newest file in the directory, but if you search something using the keys /, cm, ct, ..., it will get you to the next found entry. @@ -427,6 +451,11 @@ Change the sort method (like in mutt) .IX Item "zX" Change settings. See the settings section for a list of settings and their hotkey. +.IP "u\fI?\fR" 14 +.IX Item "u?" +Universal undo-key. Depending on the key that you press after \*(L"u\*(R", it either +restores closed tabs (uq), removes tags (ut), clears the copy/cut buffer (ud), +starts the reversed visual mode (uV) or clears the selection (uv). .IP "f" 14 .IX Item "f" Quickly navigate by entering a part of the filename. @@ -435,10 +464,11 @@ Quickly navigate by entering a part of the filename. Mark a file. .IP "v" 14 .IX Item "v" -Toggle the mark-status of all files, unmark all files. -.IP "V, uv" 14 -.IX Item "V, uv" -Unmark all files +Toggle the mark-status of all files +.IP "V" 14 +.IX Item "V" +Starts the visual mode, which selects all files between the starting point and +the cursor until you press \s-1ESC\s0. To unselect files in the same way, use \*(L"uV\*(R". .IP "/" 14 Search for files in the current directory. .IP ":" 14 @@ -456,32 +486,6 @@ Go to the next or previous tab. You can also use \s-1TAB\s0 and \s-1SHIFT+TAB\s0 .IP "gc, ^W" 14 .IX Item "gc, ^W" Close the current tab. The last tab cannot be closed this way. -.SS "\s-1MIDNIGHT\s0 COMMANDER-LIKE \s-1BINDINGS\s0" -.IX Subsection "MIDNIGHT COMMANDER-LIKE BINDINGS" -.IP "<F1>" 14 -.IX Item "<F1>" -Display Help. -.IP "<F3>" 14 -.IX Item "<F3>" -Display the file. -.IP "<F4>" 14 -.IX Item "<F4>" -Edit the file. -.IP "<F5>" 14 -.IX Item "<F5>" -Copy the file. -.IP "<F6>" 14 -.IX Item "<F6>" -Cut the file. -.IP "<F7>" 14 -.IX Item "<F7>" -Open the console with \*(L":mkdir \*(R". -.IP "<F8>" 14 -.IX Item "<F8>" -Prompt for deletion of the selected files. -.IP "<F10>" 14 -.IX Item "<F10>" -Exit ranger. .SS "READLINE-LIKE \s-1BINDINGS\s0 \s-1IN\s0 \s-1THE\s0 \s-1CONSOLE\s0" .IX Subsection "READLINE-LIKE BINDINGS IN THE CONSOLE" .IP "^B, ^F" 14 @@ -951,7 +955,7 @@ Creates an empty file with the name \fIfilename\fR, unless it already exists. Filters the current directory for files containing the letters in the string, possibly with other letters in between. The filter is applied as you type. When only one directory is left, it is entered and the console -is automatially reopened, allowing for fast travel. +is automatically reopened, allowing for fast travel. To close the console, press \s-1ESC\s0 or execute a file. .IP "tunmap [\fIkeys ...\fR]" 2 .IX Item "tunmap [keys ...]" @@ -1036,10 +1040,14 @@ These environment variables have an effect on ranger: ranger sets this environment variable to \*(L"1\*(R" or increments it if it already exists. External programs can determine whether they were spawned from ranger by checking for this variable. +.IP "\s-1RANGER_LOAD_DEFAULT_RC\s0" 8 +.IX Item "RANGER_LOAD_DEFAULT_RC" +If this variable is set to \s-1FALSE\s0, ranger will not load the default rc.conf. +This can save time if you copied the whole rc.conf to ~/.config/ranger/ and +don't need the default one at all. .IP "\s-1EDITOR\s0" 8 .IX Item "EDITOR" -Defines the editor to be used for the \*(L"E\*(R" key. Defaults to the first installed -program out of \*(L"vim\*(R", \*(L"emacs\*(R" and \*(L"nano\*(R". +Defines the editor to be used for the \*(L"E\*(R" key. Defaults to \*(L"nano\*(R". .IP "\s-1SHELL\s0" 8 .IX Item "SHELL" Defines the shell that ranger is going to use with the :shell command and @@ -1047,8 +1055,7 @@ the \*(L"S\*(R" key. Defaults to \*(L"/bin/sh\*(R". .IP "\s-1TERMCMD\s0" 8 .IX Item "TERMCMD" Defines the terminal emulator command that ranger is going to use with the -:terminal command and the \*(L"t\*(R" run flag. Defaults to \*(L"x\-terminal-emulator\*(R" or -\&\*(L"xterm\*(R" +:terminal command and the \*(L"t\*(R" run flag. Defaults to \*(L"xterm\*(R". .IP "\s-1XDG_CONFIG_HOME\s0" 8 .IX Item "XDG_CONFIG_HOME" Specifies the directory for configuration files. Defaults to \fI\f(CI$HOME\fI/.config\fR. diff --git a/doc/ranger.pod b/doc/ranger.pod index 43275b95..2a314e74 100644 --- a/doc/ranger.pod +++ b/doc/ranger.pod @@ -131,7 +131,7 @@ typing I<"<tagnameE<gt>>. =head2 PREVIEWS By default, only text files are previewed, but you can enable external preview -scripts by setting the option C<use_preview_script> and C<preview_files> to True. +scripts by setting the option C<use_preview_script> and C<preview_files> to true. This default script is F<~/.config/ranger/scope.sh>. It contains more documentation and calls to the programs I<lynx> and I<elinks> for html, @@ -141,6 +141,14 @@ I<pdftotext> for PDFs and I<mediainfo> for video and audio files. Install these programs (just the ones you need) and scope.sh will automatically use them. +Independently of the preview script, there is a feature to preview images +by drawing them directly into the terminal. This does not work over ssh, +requires certain terminals (tested on "xterm" and "urxvt") and is incompatible +with tmux, although it works with screen. + +To enable this feature, install the program "w3m" and set the option +C<preview_images> to true. + =head2 SELECTION The I<selection> is defined as "All marked files IF THERE ARE ANY, otherwise @@ -174,6 +182,10 @@ are in different directories: Macros for file paths are generally shell-escaped so they can be used in the C<shell> command. +Additionally, if you create a key binding that uses <any>, a special statement +which accepts any key, then the macro %any (or %any0, %any1, %any2, ...) can be +used in the command to get the key that was pressed. + =head2 BOOKMARKS Type B<m<keyE<gt>> to bookmark the current directory. You can re-enter this @@ -303,6 +315,14 @@ Reload everything Redraw the screen +=item i + +Display the current file in a bigger window. + +=item E + +Edit the current file in $EDITOR ("nano" by default) + =item S Open a shell in the current directory @@ -311,19 +331,27 @@ Open a shell in the current directory Opens this man page +=item <octal>=, +<who><what>, -<who><what> + +Change the permissions of the selection. For example, C<777=> is equivalent to +C<chmod 777 %s>, C<+ar> does C<chmod a+r %s>, C<-ow> does C<chmod o-w %s> etc. + =item yy -Yank the selection to the "copy" buffer and mark them as to be copied +Copy (yank) the selection, like pressing Ctrl+C in modern GUI programs. =item dd -Cut the selection to the "copy" buffer and mark them as to be moved +Cut the selection, like pressing Ctrl+X in modern GUI programs. =item pp -Paste the files from the "copy" buffer here (by moving or copying, depending on -how they are marked.) By default, this will not overwrite existing files. To -overwrite them, use I<po>. +Paste the files which were previously copied or cut, like pressing Ctrl+V in +modern GUI programs. + +=item po + +Paste the copied/cut files, overwriting existing files. =item mI<X> @@ -333,7 +361,7 @@ Create a bookmark with the name I<X> Move to the bookmark with the name I<X> -=item n, N +=item n Find the next file. By default, this gets you to the newest file in the directory, but if you search something using the keys /, cm, ct, ..., it will @@ -352,6 +380,12 @@ Change the sort method (like in mutt) Change settings. See the settings section for a list of settings and their hotkey. +=item uI<?> + +Universal undo-key. Depending on the key that you press after "u", it either +restores closed tabs (uq), removes tags (ut), clears the copy/cut buffer (ud), +starts the reversed visual mode (uV) or clears the selection (uv). + =item f Quickly navigate by entering a part of the filename. @@ -362,11 +396,12 @@ Mark a file. =item v -Toggle the mark-status of all files, unmark all files. +Toggle the mark-status of all files -=item V, uv +=item V -Unmark all files +Starts the visual mode, which selects all files between the starting point and +the cursor until you press ESC. To unselect files in the same way, use "uV". =item / @@ -376,7 +411,6 @@ Search for files in the current directory. Open the console. - =item Alt-I<N> Open a tab. N has to be a number from 0 to 9. If the tab doesn't exist yet, it @@ -396,44 +430,6 @@ Close the current tab. The last tab cannot be closed this way. =back -=head2 MIDNIGHT COMMANDER-LIKE BINDINGS - -=over 14 - -=item <F1> - -Display Help. - -=item <F3> - -Display the file. - -=item <F4> - -Edit the file. - -=item <F5> - -Copy the file. - -=item <F6> - -Cut the file. - -=item <F7> - -Open the console with ":mkdir ". - -=item <F8> - -Prompt for deletion of the selected files. - -=item <F10> - -Exit ranger. - -=back - =head2 READLINE-LIKE BINDINGS IN THE CONSOLE =over 14 @@ -1000,7 +996,7 @@ Creates an empty file with the name I<filename>, unless it already exists. Filters the current directory for files containing the letters in the string, possibly with other letters in between. The filter is applied as you type. When only one directory is left, it is entered and the console -is automatially reopened, allowing for fast travel. +is automatically reopened, allowing for fast travel. To close the console, press ESC or execute a file. =item tunmap [I<keys ...>] @@ -1121,10 +1117,15 @@ ranger sets this environment variable to "1" or increments it if it already exists. External programs can determine whether they were spawned from ranger by checking for this variable. +=item RANGER_LOAD_DEFAULT_RC + +If this variable is set to FALSE, ranger will not load the default rc.conf. +This can save time if you copied the whole rc.conf to ~/.config/ranger/ and +don't need the default one at all. + =item EDITOR -Defines the editor to be used for the "E" key. Defaults to the first installed -program out of "vim", "emacs" and "nano". +Defines the editor to be used for the "E" key. Defaults to "nano". =item SHELL @@ -1134,8 +1135,7 @@ the "S" key. Defaults to "/bin/sh". =item TERMCMD Defines the terminal emulator command that ranger is going to use with the -:terminal command and the "t" run flag. Defaults to "x-terminal-emulator" or -"xterm" +:terminal command and the "t" run flag. Defaults to "xterm". =item XDG_CONFIG_HOME diff --git a/examples/plugin_chmod_keybindings.py b/examples/plugin_chmod_keybindings.py index 9c9a0982..f26cb3e3 100644 --- a/examples/plugin_chmod_keybindings.py +++ b/examples/plugin_chmod_keybindings.py @@ -10,7 +10,7 @@ def hook_init(fm): # Generate key bindings for the chmod command command = "map {0}{1}{2} shell -d chmod {1}{0}{2} %s" - for mode in list('ugoa') + '': + for mode in list('ugoa') + ['']: for perm in "rwxXst": fm.execute_console(command.format('-', mode, perm)) fm.execute_console(command.format('+', mode, perm)) diff --git a/examples/plugin_hello_world.py b/examples/plugin_hello_world.py index 187f428e..e43eb61d 100644 --- a/examples/plugin_hello_world.py +++ b/examples/plugin_hello_world.py @@ -11,11 +11,11 @@ old_hook_ready = ranger.api.hook_ready # Create a replacement for the hook that... def hook_ready(fm): - # ...does the desired action... - fm.notify("Hello World") - # ...and calls the saved hook. If you don't care about the return value, simply - # return the return value of the previous hook to be on the safe side. - return old_hook_ready(fm) + # ...does the desired action... + fm.notify("Hello World") + # ...and calls the saved hook. If you don't care about the return value, + # simply return the return value of the previous hook to be safe. + return old_hook_ready(fm) # Finally, "monkey patch" the existing hook_ready function with our replacement: ranger.api.hook_ready = hook_ready diff --git a/examples/plugin_skip_default_rc.py b/examples/plugin_skip_default_rc.py deleted file mode 100644 index 6a657a99..00000000 --- a/examples/plugin_skip_default_rc.py +++ /dev/null @@ -1,9 +0,0 @@ -# This plugin inhibits the loading of the default rc.conf. This serves to -# speed up starting time by avoiding to load rc.conf twice if you have a full -# copy of it in ~/.config/ranger. -# -# Don't use this if you have a supplementary rc.conf or no rc.conf at all, or -# you will end up without key bindings and options. - -import ranger.core.main -ranger.core.main.load_default_config = False diff --git a/ranger.py b/ranger.py index d2e90ae7..49a3f36d 100755 --- a/ranger.py +++ b/ranger.py @@ -1,6 +1,6 @@ #!/usr/bin/python -O # ranger - a vim-inspired file manager for the console (coding: utf-8) -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. # ===================== diff --git a/ranger/__init__.py b/ranger/__init__.py index 2dbffb7e..8dbd7fc6 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ @@ -16,7 +16,7 @@ import os __license__ = 'GPL3' __version__ = '1.5.5' __author__ = __maintainer__ = 'Roman Zimbelmann' -__email__ = 'romanz@lavabit.com' +__email__ = 'hut@lavabit.com' # Constants RANGERDIR = os.path.dirname(__file__) diff --git a/ranger/api/commands.py b/ranger/api/commands.py index 010ea37b..8a9df1ec 100644 --- a/ranger/api/commands.py +++ b/ranger/api/commands.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. # TODO: Add an optional "!" to all commands and set a flag if it's there diff --git a/ranger/api/options.py b/ranger/api/options.py index 38e5f760..1d90f228 100644 --- a/ranger/api/options.py +++ b/ranger/api/options.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. # THIS WHOLE FILE IS OBSOLETE AND EXISTS FOR BACKWARDS COMPATIBILITIY diff --git a/ranger/colorschemes/default.py b/ranger/colorschemes/default.py index a391f03c..767d370d 100644 --- a/ranger/colorschemes/default.py +++ b/ranger/colorschemes/default.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from ranger.gui.colorscheme import ColorScheme diff --git a/ranger/colorschemes/jungle.py b/ranger/colorschemes/jungle.py index 01a5ab1f..42a8465c 100644 --- a/ranger/colorschemes/jungle.py +++ b/ranger/colorschemes/jungle.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from ranger.gui.color import * diff --git a/ranger/colorschemes/snow.py b/ranger/colorschemes/snow.py index e3b433b6..b2da0a39 100644 --- a/ranger/colorschemes/snow.py +++ b/ranger/colorschemes/snow.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from ranger.gui.colorscheme import ColorScheme diff --git a/ranger/config/commands.py b/ranger/config/commands.py index daeb49f7..66869c70 100644 --- a/ranger/config/commands.py +++ b/ranger/config/commands.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This configuration file is licensed under the same terms as ranger. # =================================================================== # This file contains ranger's commands. @@ -344,7 +344,10 @@ class find(Command): def execute(self): if self.quick(): - self.fm.move(right=1) + if self.rest(1) == '..': + self.fm.move(left=1) + else: + self.fm.move(right=1) self.fm.block_input(0.5) else: self.fm.cd(self.rest(1)) diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf index 1138ac27..1343e07e 100644 --- a/ranger/config/rc.conf +++ b/ranger/config/rc.conf @@ -3,8 +3,8 @@ # To change them, it is recommended to create the file # ~/.config/ranger/rc.conf and add your custom commands there. # -# If you copy this whole file there, you may want to install the plugin -# "plugins/plugin_skip_default_rc.py" to avoid loading the rc.conf twice. +# If you copy this whole file there, you may want to set the environment +# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice. # # The purpose of this file is mainly to define keybindings and settings. # For running more complex python code, please create a plugin in "plugins/" or @@ -52,6 +52,8 @@ set vcs_backend_hg disabled set vcs_backend_bzr disabled # Preview images in full color with the external command "w3mimgpreview"? +# This requires the console web browser "w3m" and a supported terminal. +# It has been successfully tested with "xterm" and "urxvt" without tmux. set preview_images false # Use a unicode "..." character to mark cut-off filenames? @@ -61,8 +63,7 @@ set unicode_ellipsis false set show_hidden_bookmarks true # Which colorscheme to use? These colorschemes are available by default: -# default, default88, jungle, snow -# Snow is monochrome and default88 uses 88 colors. +# default, jungle, snow set colorscheme default # Preview files on the rightmost column? @@ -79,7 +80,7 @@ set status_bar_on_top false # Draw a progress bar in the status bar which displays the average state of all # currently running tasks which support progress bars? -set draw_progress_bar_in_status_bar True +set draw_progress_bar_in_status_bar true # Draw borders around columns? set draw_borders false @@ -104,7 +105,7 @@ set update_title false set update_tmux_title false # Shorten the title if it gets long? The number defines how many -# directories are displayed at once, False turns off this feature. +# directories are displayed at once, 0 turns off this feature. set shorten_title 3 # Abbreviate $HOME with ~ in the titlebar (first line) of ranger? @@ -202,7 +203,7 @@ map cd console cd # Tagging / Marking map t tag_toggle -map T tag_remove +map ut tag_remove map "<any> tag_toggle tag=%any map <Space> mark_files toggle=True map v mark_files all=True toggle=True diff --git a/ranger/container/bookmarks.py b/ranger/container/bookmarks.py index f5476dd8..fa4679b6 100644 --- a/ranger/container/bookmarks.py +++ b/ranger/container/bookmarks.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import string diff --git a/ranger/container/history.py b/ranger/container/history.py index 6939c533..1bc15a53 100644 --- a/ranger/container/history.py +++ b/ranger/container/history.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. # TODO: rewrite to use deque instead of list diff --git a/ranger/container/settingobject.py b/ranger/container/settingobject.py index 06572d97..8fa27a43 100644 --- a/ranger/container/settingobject.py +++ b/ranger/container/settingobject.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from inspect import isfunction diff --git a/ranger/container/tags.py b/ranger/container/tags.py index b37ac4dc..45090d9d 100644 --- a/ranger/container/tags.py +++ b/ranger/container/tags.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from os.path import isdir, exists, dirname, abspath, realpath, expanduser diff --git a/ranger/core/actions.py b/ranger/core/actions.py index e0612952..6b75c691 100644 --- a/ranger/core/actions.py +++ b/ranger/core/actions.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import codecs @@ -864,7 +864,7 @@ class Actions(FileManagerAware, EnvironmentAware, SettingsAware): f.close() else: data[(-1, -1)] = None - if self.thisfile.realpath == path: + if self.thisfile and self.thisfile.realpath == path: self.ui.browser.need_redraw = True data['loading'] = False pager = self.ui.browser.pager diff --git a/ranger/core/environment.py b/ranger/core/environment.py index 6ef61941..56bed156 100644 --- a/ranger/core/environment.py +++ b/ranger/core/environment.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. # THIS WHOLE FILE IS OBSOLETE AND EXISTS FOR BACKWARDS COMPATIBILITIY diff --git a/ranger/core/fm.py b/ranger/core/fm.py index e9ffb888..a217be95 100644 --- a/ranger/core/fm.py +++ b/ranger/core/fm.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/core/loader.py b/ranger/core/loader.py index e968b2eb..efcc0983 100644 --- a/ranger/core/loader.py +++ b/ranger/core/loader.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from collections import deque diff --git a/ranger/core/main.py b/ranger/core/main.py index 16096deb..dc35b47e 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ @@ -8,8 +8,6 @@ The main function responsible to initialize the FM object and stuff. import os.path import sys -load_default_config = True - def main(): """initialize objects and run the filemanager""" import locale @@ -234,7 +232,6 @@ def parse_arguments(): def load_settings(fm, clean): - global load_default_config from ranger.core.actions import Actions import ranger.core.shared import ranger.api.commands @@ -264,7 +261,7 @@ def load_settings(fm, clean): custom_conf = fm.confpath('rc.conf') default_conf = fm.relpath('config', 'rc.conf') - if load_default_config: + if os.environ.get('RANGER_LOAD_DEFAULT_RC', 0) != 'FALSE': fm.source(default_conf) if os.access(custom_conf, os.R_OK): fm.source(custom_conf) diff --git a/ranger/core/runner.py b/ranger/core/runner.py index 223bc1b6..0e4138d7 100644 --- a/ranger/core/runner.py +++ b/ranger/core/runner.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/core/shared.py b/ranger/core/shared.py index 7b679bb0..22203e0f 100644 --- a/ranger/core/shared.py +++ b/ranger/core/shared.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """Shared objects contain singleton variables which can be @@ -54,7 +54,7 @@ class SettingsAware(Awareness): after_setting_preview_script, priority=1) def after_setting_use_preview_script(signal): if signal.fm.settings.preview_script is None and signal.value \ - and not signal.previous: + and signal.fm.ui.is_on: signal.fm.notify("Preview script undefined or not found!", bad=True) settings.signal_bind('setopt.use_preview_script', diff --git a/ranger/core/tab.py b/ranger/core/tab.py index ae9d9073..212d58ef 100644 --- a/ranger/core/tab.py +++ b/ranger/core/tab.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import os diff --git a/ranger/ext/accumulator.py b/ranger/ext/accumulator.py index a027ecc2..75fec352 100644 --- a/ranger/ext/accumulator.py +++ b/ranger/ext/accumulator.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from ranger.ext.direction import Direction diff --git a/ranger/ext/cached_function.py b/ranger/ext/cached_function.py index ad7c5c11..daee6397 100644 --- a/ranger/ext/cached_function.py +++ b/ranger/ext/cached_function.py @@ -1,15 +1,15 @@ -# Copyright (C) 2012 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2012-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. def cached_function(fnc): - cache = {} - def inner_cached_function(*args): - try: - return cache[args] - except: - value = fnc(*args) - cache[args] = value - return value - inner_cached_function._cache = cache - return inner_cached_function + cache = {} + def inner_cached_function(*args): + try: + return cache[args] + except: + value = fnc(*args) + cache[args] = value + return value + inner_cached_function._cache = cache + return inner_cached_function diff --git a/ranger/ext/curses_interrupt_handler.py b/ranger/ext/curses_interrupt_handler.py index 50caebf7..91bbc3e4 100644 --- a/ranger/ext/curses_interrupt_handler.py +++ b/ranger/ext/curses_interrupt_handler.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/ext/direction.py b/ranger/ext/direction.py index eb359afb..371b417c 100644 --- a/ranger/ext/direction.py +++ b/ranger/ext/direction.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/ext/get_executables.py b/ranger/ext/get_executables.py index cf0d2a15..f9e3c021 100644 --- a/ranger/ext/get_executables.py +++ b/ranger/ext/get_executables.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from stat import S_IXOTH, S_IFREG diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py index 0e3f3d4b..f1c5b1f6 100644 --- a/ranger/ext/human_readable.py +++ b/ranger/ext/human_readable.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. def human_readable(byte, separator=' '): diff --git a/ranger/ext/iter_tools.py b/ranger/ext/iter_tools.py index 9e8fcd74..f962a37d 100644 --- a/ranger/ext/iter_tools.py +++ b/ranger/ext/iter_tools.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from collections import deque diff --git a/ranger/ext/keybinding_parser.py b/ranger/ext/keybinding_parser.py index 3439fa80..a8ae0cb8 100644 --- a/ranger/ext/keybinding_parser.py +++ b/ranger/ext/keybinding_parser.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import sys diff --git a/ranger/ext/mount_path.py b/ranger/ext/mount_path.py index 2114957a..9697884f 100644 --- a/ranger/ext/mount_path.py +++ b/ranger/ext/mount_path.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from os.path import realpath, abspath, dirname, ismount diff --git a/ranger/ext/next_available_filename.py b/ranger/ext/next_available_filename.py index 67d56126..38d13e16 100644 --- a/ranger/ext/next_available_filename.py +++ b/ranger/ext/next_available_filename.py @@ -1,4 +1,4 @@ -# Copyright (C) 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2011-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import os.path diff --git a/ranger/ext/openstruct.py b/ranger/ext/openstruct.py index af2e027e..710a8263 100644 --- a/ranger/ext/openstruct.py +++ b/ranger/ext/openstruct.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. # prepend __ to arguments because one might use "args" diff --git a/ranger/ext/popen_forked.py b/ranger/ext/popen_forked.py index 6c40d552..8ecba331 100644 --- a/ranger/ext/popen_forked.py +++ b/ranger/ext/popen_forked.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2012-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import os diff --git a/ranger/ext/relative_symlink.py b/ranger/ext/relative_symlink.py index 347aad8c..a8029880 100644 --- a/ranger/ext/relative_symlink.py +++ b/ranger/ext/relative_symlink.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from os import symlink, sep diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py index c94dd74b..e28c8bd6 100755 --- a/ranger/ext/rifle.py +++ b/ranger/ext/rifle.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -S -# Copyright (C) 2012 Roman Zimbelmann <romanz@lavabit.com> +#!/usr/bin/python +# Copyright (C) 2012-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ @@ -373,9 +373,19 @@ def main(): conf_path = os.environ['XDG_CONFIG_HOME'] + '/ranger/rifle.conf' else: conf_path = os.path.expanduser('~/.config/ranger/rifle.conf') + default_conf_path = conf_path if not os.path.isfile(conf_path): conf_path = os.path.normpath(os.path.join(os.path.dirname(__file__), '../config/rifle.conf')) + if not os.path.isfile(conf_path): + try: + # if ranger is installed, get the configuration from ranger + import ranger + except ImportError: + pass + else: + conf_path = os.path.join(ranger.__path__[0], "config", "rifle.conf") + # Evaluate arguments from optparse import OptionParser @@ -396,6 +406,11 @@ def main(): parser.print_help() raise SystemExit(1) + if not os.path.isfile(conf_path): + sys.stderr.write("Could not find a configuration file.\n" + "Please create one at %s.\n" % default_conf_path) + raise SystemExit(1) + if options.p.isdigit(): number = int(options.p) label = None diff --git a/ranger/ext/run_forked.py b/ranger/ext/run_forked.py index f08494b9..39d08e51 100644 --- a/ranger/ext/run_forked.py +++ b/ranger/ext/run_forked.py @@ -1,4 +1,4 @@ -# Copyright (C) 2012 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2012-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import os diff --git a/ranger/ext/shell_escape.py b/ranger/ext/shell_escape.py index d67b9083..a4e5628d 100644 --- a/ranger/ext/shell_escape.py +++ b/ranger/ext/shell_escape.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/ext/signals.py b/ranger/ext/signals.py index e42e740d..5ff467aa 100644 --- a/ranger/ext/signals.py +++ b/ranger/ext/signals.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/ext/spawn.py b/ranger/ext/spawn.py index 13fbd252..240fa94a 100644 --- a/ranger/ext/spawn.py +++ b/ranger/ext/spawn.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from subprocess import Popen, PIPE diff --git a/ranger/ext/widestring.py b/ranger/ext/widestring.py index 31e41210..c5b26a18 100644 --- a/ranger/ext/widestring.py +++ b/ranger/ext/widestring.py @@ -1,5 +1,5 @@ # -*- encoding: utf8 -*- -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import sys diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py index 86014f38..6aa58f37 100644 --- a/ranger/fsobject/directory.py +++ b/ranger/fsobject/directory.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import os.path diff --git a/ranger/fsobject/file.py b/ranger/fsobject/file.py index 2a287ff5..0b4f9776 100644 --- a/ranger/fsobject/file.py +++ b/ranger/fsobject/file.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import re diff --git a/ranger/fsobject/fsobject.py b/ranger/fsobject/fsobject.py index f8a8d162..b0b70098 100644 --- a/ranger/fsobject/fsobject.py +++ b/ranger/fsobject/fsobject.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. CONTAINER_EXTENSIONS = ('7z', 'ace', 'ar', 'arc', 'bz', 'bz2', 'cab', 'cpio', diff --git a/ranger/gui/ansi.py b/ranger/gui/ansi.py index 7019c6fb..ba6aa44d 100644 --- a/ranger/gui/ansi.py +++ b/ranger/gui/ansi.py @@ -1,5 +1,5 @@ # Copyright (C) 2010 David Barnett <davidbarnett2@gmail.com> -# Copyright (C) 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2010-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/gui/bar.py b/ranger/gui/bar.py index ebd56166..6bba85c4 100644 --- a/ranger/gui/bar.py +++ b/ranger/gui/bar.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from ranger.ext.widestring import WideString, utf_char_width diff --git a/ranger/gui/color.py b/ranger/gui/color.py index ab986b55..06f49147 100644 --- a/ranger/gui/color.py +++ b/ranger/gui/color.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/gui/colorscheme.py b/ranger/gui/colorscheme.py index 0a142d52..b44eacd0 100644 --- a/ranger/gui/colorscheme.py +++ b/ranger/gui/colorscheme.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/gui/context.py b/ranger/gui/context.py index 2ea23571..ecef7d07 100644 --- a/ranger/gui/context.py +++ b/ranger/gui/context.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. CONTEXT_KEYS = ['reset', 'error', 'badinfo', diff --git a/ranger/gui/curses_shortcuts.py b/ranger/gui/curses_shortcuts.py index 82640322..571824ba 100644 --- a/ranger/gui/curses_shortcuts.py +++ b/ranger/gui/curses_shortcuts.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # Copyright (C) 2010 David Barnett <davidbarnett2@gmail.com> # This software is distributed under the terms of the GNU GPL version 3. diff --git a/ranger/gui/displayable.py b/ranger/gui/displayable.py index e5431039..78bc0448 100644 --- a/ranger/gui/displayable.py +++ b/ranger/gui/displayable.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. from ranger.core.shared import FileManagerAware, EnvironmentAware diff --git a/ranger/gui/mouse_event.py b/ranger/gui/mouse_event.py index 1f157570..2533cc4d 100644 --- a/ranger/gui/mouse_event.py +++ b/ranger/gui/mouse_event.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import curses diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py index 5760090c..b2db6975 100644 --- a/ranger/gui/ui.py +++ b/ranger/gui/ui.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import os diff --git a/ranger/gui/widgets/browsercolumn.py b/ranger/gui/widgets/browsercolumn.py index 38a7fdcb..d2c5e400 100644 --- a/ranger/gui/widgets/browsercolumn.py +++ b/ranger/gui/widgets/browsercolumn.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """The BrowserColumn widget displays the contents of a directory or file.""" diff --git a/ranger/gui/widgets/browserview.py b/ranger/gui/widgets/browserview.py index e0a2275e..c3e264ad 100644 --- a/ranger/gui/widgets/browserview.py +++ b/ranger/gui/widgets/browserview.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """The BrowserView manages a set of BrowserColumns.""" @@ -131,15 +131,17 @@ class BrowserView(Widget, DisplayableContainer): left_start = child.x + child.wid else: break - if not self.pager.visible: - for child in reversed(self.columns): - if not child.has_preview(): - right_end = child.x - 1 - else: - break + + # Shift the rightmost vertical line to the left to create a padding, + # but only when padding_right is on, the preview column is collapsed + # and we did not open the pager to "zoom" in to the file. + if self.settings.padding_right and not self.pager.visible and \ + self.is_collapsed: + right_end = self.columns[-1].x - 1 if right_end < left_start: right_end = self.wid - 1 + # Draw horizontal lines and the leftmost vertical line try: win.hline(0, left_start, curses.ACS_HLINE, right_end - left_start) win.hline(self.hei - 1, left_start, curses.ACS_HLINE, @@ -148,11 +150,13 @@ class BrowserView(Widget, DisplayableContainer): except _curses.error: pass - for child in self.columns: + # Draw the vertical lines in the middle + for child in self.columns[:-1]: if not child.has_preview(): continue if child.main_column and self.pager.visible: - win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) + # If we "zoom in" with the pager, we have to + # skip the between main_column and pager. break x = child.x + child.wid y = self.hei - 1 @@ -164,6 +168,12 @@ class BrowserView(Widget, DisplayableContainer): # in case it's off the boundaries pass + # Draw the last vertical line + try: + win.vline(1, right_end, curses.ACS_VLINE, self.hei - 2) + except _curses.error: + pass + self.addch(0, left_start, curses.ACS_ULCORNER) self.addch(self.hei - 1, left_start, curses.ACS_LLCORNER) self.addch(0, right_end, curses.ACS_URCORNER) diff --git a/ranger/gui/widgets/console.py b/ranger/gui/widgets/console.py index 10458a54..c9271cac 100644 --- a/ranger/gui/widgets/console.py +++ b/ranger/gui/widgets/console.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/gui/widgets/pager.py b/ranger/gui/widgets/pager.py index de73ddc2..f5988e08 100644 --- a/ranger/gui/widgets/pager.py +++ b/ranger/gui/widgets/pager.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # Copyright (C) 2010 David Barnett <davidbarnett2@gmail.com> # This software is distributed under the terms of the GNU GPL version 3. @@ -40,7 +40,7 @@ class Pager(Widget): self.need_redraw = True def clear_image(self, force=False): - if force or self.need_clear_image: + if (force or self.need_clear_image) and self.image_drawn: img_display.clear(self.x, self.y, self.wid, self.hei) self.need_clear_image = False self.image_drawn = False @@ -53,8 +53,7 @@ class Pager(Widget): self.source.close() def destroy(self): - if self.image_drawn: - img_display.clear(self.x, self.y, self.wid, self.hei) + self.clear_image(force=True) def finalize(self): self.fm.ui.win.move(self.y, self.x) diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py index da21b098..3d860fbc 100644 --- a/ranger/gui/widgets/statusbar.py +++ b/ranger/gui/widgets/statusbar.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ @@ -177,8 +177,7 @@ class StatusBar(Widget): if self.settings.display_size_in_status_bar and target.infostring: left.add(target.infostring.replace(" ", "")) - - left.add_space() + left.add_space() left.add(strftime(self.timeformat, localtime(stat.st_mtime)), 'mtime') diff --git a/ranger/gui/widgets/taskview.py b/ranger/gui/widgets/taskview.py index 3637d0e3..ae69402a 100644 --- a/ranger/gui/widgets/taskview.py +++ b/ranger/gui/widgets/taskview.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/ranger/gui/widgets/titlebar.py b/ranger/gui/widgets/titlebar.py index 5986ec7a..2a17211f 100644 --- a/ranger/gui/widgets/titlebar.py +++ b/ranger/gui/widgets/titlebar.py @@ -1,4 +1,4 @@ -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. """ diff --git a/setup.py b/setup.py index b4be9965..5d71cb53 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com> +# Copyright (C) 2009-2013 Roman Zimbelmann <hut@lavabit.com> # This software is distributed under the terms of the GNU GPL version 3. import distutils.core |