about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--doc/ranger.133
-rw-r--r--doc/ranger.pod3
-rw-r--r--ranger/config/rc.conf3
-rw-r--r--ranger/container/settings.py1
-rw-r--r--ranger/ext/img_display.py7
5 files changed, 28 insertions, 19 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index 4bbcc60c..069f56c9 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
+.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32)
 .\"
 .\" Standard preamble:
 .\" ========================================================================
@@ -54,20 +54,16 @@
 .\" Avoid warning from groff about undefined register 'F'.
 .de IX
 ..
-.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 .nr F 0
+.if \nF>0 \{\
+.    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.
@@ -133,7 +129,7 @@
 .\" ========================================================================
 .\"
 .IX Title "RANGER 1"
-.TH RANGER 1 "ranger-1.9.2" "2018-09-10" "ranger manual"
+.TH RANGER 1 "ranger-1.9.2" "10/07/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 +169,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 \fBrifle\fR\|(1) describes the functions of the file opener
+The man page of \fIrifle\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"
@@ -299,6 +295,9 @@ This does not work over ssh, requires certain terminals (tested on \*(L"xterm\*(
 To enable this feature, install the program \*(L"w3m\*(R" and set the option
 \&\f(CW\*(C`preview_images_method\*(C'\fR to w3m.
 .PP
+When using a terminal with a nonzero border which is not automatically detected, the w3m preview will be misaligned.
+Use the \f(CW\*(C`w3m_offset\*(C'\fR option to manually adjust the image offset. This should be the same value as the terminal's border value.
+.PP
 \fIiTerm2\fR
 .IX Subsection "iTerm2"
 .PP
@@ -339,7 +338,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.
@@ -625,7 +624,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
@@ -1655,7 +1654,7 @@ copy, run:
 .Ve
 .SH "SEE ALSO"
 .IX Header "SEE ALSO"
-\&\fBrifle\fR\|(1)
+\&\fIrifle\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 637973ac..d671ebbb 100644
--- a/doc/ranger.pod
+++ b/doc/ranger.pod
@@ -209,6 +209,9 @@ This does not work over ssh, requires certain terminals (tested on "xterm" and
 To enable this feature, install the program "w3m" and set the option
 C<preview_images_method> to w3m.
 
+When using a terminal with a nonzero border which is not automatically detected, the w3m preview will be misaligned.
+Use the C<w3m_offset> option to manually adjust the image offset. This should be the same value as the terminal's border value.
+
 =head3 iTerm2
 
 This only works in iTerm2 compiled with image preview support, but works over
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index a32ab494..9963da2c 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -112,6 +112,9 @@ set preview_images_method w3m
 # Increase it in case of experiencing display corruption.
 set w3m_delay 0.02
 
+# Manually adjust the w3mimg offset when using a terminal which needs this
+set w3m_offset 0
+
 # Default iTerm2 font size (see: preview_images_method: iterm2)
 set iterm2_font_width 8
 set iterm2_font_height 11
diff --git a/ranger/container/settings.py b/ranger/container/settings.py
index 70a12b51..405aaa48 100644
--- a/ranger/container/settings.py
+++ b/ranger/container/settings.py
@@ -94,6 +94,7 @@ ALLOWED_SETTINGS = {
     'vcs_backend_svn': str,
     'viewmode': str,
     'w3m_delay': float,
+    'w3m_offset': int,
     'wrap_scroll': bool,
     'xterm_alt_key': bool,
 }
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index cd9b18d6..3f5b5471 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -219,9 +219,12 @@ class W3MImageDisplayer(ImageDisplayer, FileManagerAware):
             width = (width * max_height_pixels) // height
             height = max_height_pixels
 
+        start_x = int((start_x - 0.2) * fontw) + self.fm.settings.w3m_offset
+        start_y = (start_y * fonth) + self.fm.settings.w3m_offset
+
         return "0;1;{x};{y};{w};{h};;;;;{filename}\n4;\n3;\n".format(
-            x=int((start_x - 0.2) * fontw),
-            y=start_y * fonth,
+            x=start_x,
+            y=start_y,
             # y = (start_y + 1) * fonth, # (for tmux top status bar)
             w=width,
             h=height,