summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorseebye <seebye@users.noreply.github.com>2018-10-25 16:56:54 +0200
committerGitHub <noreply@github.com>2018-10-25 16:56:54 +0200
commit161e3ec39602788d3336e7982ed6edf915ddb7a1 (patch)
tree25976457dcdb9a8082b1571604a7e75ca3a8f37d
parentf533187b735328956e0c57d7b39677441e1edc85 (diff)
parentb5f75a6429d5610ce62998cc7b22227094b7c5eb (diff)
downloadranger-161e3ec39602788d3336e7982ed6edf915ddb7a1.tar.gz
Merge branch 'master' into master
-rw-r--r--doc/ranger.137
-rw-r--r--doc/ranger.pod4
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/core/actions.py7
-rw-r--r--ranger/ext/human_readable.py5
-rwxr-xr-xranger/ext/rifle.py2
7 files changed, 38 insertions, 21 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 0cb65d80..b7d70ae1 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32)
+.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -54,16 +54,20 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.if !\nF .nr F 0
-.if \nF>0 \{\
-.    de IX
-.    tm Index:\\$1\t\\n%\t"\\$2"
+.nr rF 0
+.if \n(.g .if rF .nr rF 1
+.if (\n(rF:(\n(.g==0)) \{\
+.    if \nF \{\
+.        de IX
+.        tm Index:\\$1\t\\n%\t"\\$2"
 ..
-.    if !\nF==2 \{\
-.        nr % 0
-.        nr F 2
+.        if !\nF==2 \{\
+.            nr % 0
+.            nr F 2
+.        \}
 .    \}
 .\}
+.rr rF
 .\"
 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
@@ -129,11 +133,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-<<<<<<< HEAD
-.TH RANGER 1 "ranger-1.9.2" "2018-10-08" "ranger manual"
-=======
-.TH RANGER 1 "ranger-1.9.2" "10/07/2018" "ranger manual"
->>>>>>> LeLobster-stborderw3mfix
+.TH RANGER 1 "ranger-1.9.2" "10/14/2018" "ranger manual"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -173,7 +173,7 @@ plugins, sample configuration files and some programs for integrating ranger
 with other software.  They are usually installed to
 \&\fI/usr/share/doc/ranger/examples\fR.
 .PP
-The man page of \fIrifle\fR\|(1) describes the functions of the file opener
+The man page of \fBrifle\fR\|(1) describes the functions of the file opener
 .PP
 The section \fI\s-1LINKS\s0\fR of this man page contains further resources.
 .SH "POSITIONAL ARGUMENTS"
@@ -342,7 +342,7 @@ To enable this feature, set the option \f(CW\*(C`preview_images_method\*(C'\fR t
 \fIkitty\fR
 .IX Subsection "kitty"
 .PP
-This only works on Kitty. It requires \s-1PIL \s0(or pillow) to work.
+This only works on Kitty. It requires \s-1PIL\s0 (or pillow) to work.
 Allows remote image previews, for example in an ssh session.
 .PP
 To enable this feature, set the option \f(CW\*(C`preview_images_method\*(C'\fR to kitty.
@@ -628,7 +628,7 @@ 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".
+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
@@ -893,6 +893,9 @@ Otherwise the submaps are replaced with \*(L"...\*(R".
 .IP "hostname_in_titlebar [bool]" 4
 .IX Item "hostname_in_titlebar [bool]"
 Show hostname in titlebar?
+.IP "size_in_bytes [bool]" 4
+.IX Item "size_in_bytes [bool]"
+Print file sizes in bytes instead of the default human-readable format.
 .IP "idle_delay [integer]" 4
 .IX Item "idle_delay [integer]"
 The delay that ranger idly waits for user input, in milliseconds, with a
@@ -1661,7 +1664,7 @@ copy, run:
 .Ve
 .SH "SEE ALSO"
 .IX Header "SEE ALSO"
-\&\fIrifle\fR\|(1)
+\&\fBrifle\fR\|(1)
 .SH "BUGS"
 .IX Header "BUGS"
 Report bugs here: <https://github.com/ranger/ranger/issues>
diff --git a/doc/ranger.pod b/doc/ranger.pod
index c68e7246..f822df39 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -908,6 +908,10 @@ Otherwise the submaps are replaced with "...".
 
 Show hostname in titlebar?
 
+=item size_in_bytes [bool]
+
+Print file sizes in bytes instead of the default human-readable format.
+
 =item idle_delay [integer]
 
 The delay that ranger idly waits for user input, in milliseconds, with a
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index bccf7c56..98a059d4 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -298,6 +298,9 @@ set global_inode_type_filter
 # should be 'false' during start-up, but you can toggle it by pressing F.
 set freeze_files false
 
+# Print file sizes in bytes instead of the default human-readable format.
+set size_in_bytes false
+
 # ===================================================================
 # == Local Options
 # ===================================================================
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 651d5120..478f6124 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -49,6 +49,7 @@ ALLOWED_SETTINGS = {
     'hidden_filter': str,
     'hint_collapse_threshold': int,
     'hostname_in_titlebar': bool,
+    'size_in_bytes': bool,
     'idle_delay': int,
     'iterm2_font_width': int,
     'iterm2_font_height': int,
diff --git a/ranger/core/actions.py b/ranger/core/actions.py
index 89c5124b..4e76df65 100644
--- a/ranger/core/actions.py
+++ b/ranger/core/actions.py
@@ -998,12 +998,15 @@ class Actions(  # pylint: disable=too-many-instance-attributes,too-many-public-m
     def scroll_preview(self, lines, narg=None):
         """:scroll_preview <lines>
 
-Scroll the file preview by <lines> lines."""
+        Scroll the file preview by <lines> lines.
+        """
         preview_column = self.ui.browser.columns[-1]
         if preview_column.target and preview_column.target.is_file:
             if narg is not None:
                 lines = narg
-            preview_column.scrollbit = max(0, preview_column.scrollbit + lines)
+            target_scroll = preview_column.scrollbit + lines
+            max_scroll = len(preview_column.lines) - preview_column.hei
+            preview_column.scrollbit = max(0, min(target_scroll, max_scroll))
             preview_column.request_redraw()
 
     # --------------------------
diff --git a/ranger/ext/human_readable.py b/ranger/ext/human_readable.py
index f365e594..385e56f4 100644
--- a/ranger/ext/human_readable.py
+++ b/ranger/ext/human_readable.py
@@ -3,6 +3,8 @@
 
 from __future__ import (absolute_import, division, print_function)
 
+from ranger.core.shared import SettingsAware
+
 
 def human_readable(byte, separator=' '):  # pylint: disable=too-many-return-statements
     """Convert a large number of bytes to an easily readable format.
@@ -19,6 +21,9 @@ def human_readable(byte, separator=' '):  # pylint: disable=too-many-return-stat
     if byte is None:
         return ''
 
+    if SettingsAware.settings.size_in_bytes:
+        return format(byte, 'n')  # 'n' = locale-aware separator.
+
     # I know this can be written much shorter, but this long version
     # performs much better than what I had before.  If you attempt to
     # shorten this code, take performance into consideration.
diff --git a/ranger/ext/rifle.py b/ranger/ext/rifle.py
index ee156d9a..377f9b8a 100755
--- a/ranger/ext/rifle.py
+++ b/ranger/ext/rifle.py
@@ -162,9 +162,7 @@ class Rifle(object):  # pylint: disable=too-many-instance-attributes
             config_file = self.config_file
         fobj = open(config_file, 'r')
         self.rules = []
-        lineno = 0
         for line in fobj:
-            lineno += 1
             line = line.strip()
             if line.startswith('#') or line == '':
                 continue