summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorShotaro Fujimoto <fuji101ijuf@gmail.com>2015-06-21 14:36:10 +0900
committerShotaro Fujimoto <fuji101ijuf@gmail.com>2015-06-21 14:36:10 +0900
commit9909e16551da908f079bb12c10652e82cd109cbe (patch)
treee30c32308a1d120a41ecc41a4001c7bc68e0ef29
parent95a697e66ed57470b8aba68b637dfdf3ad541124 (diff)
downloadranger-9909e16551da908f079bb12c10652e82cd109cbe.tar.gz
use muximum height to display image
(commented the setting for tmux top status bar user)
-rw-r--r--ranger/ext/img_display.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 699f04d9..a9d85282 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -76,9 +76,13 @@ class W3MImageDisplayer(ImageDisplayer):
 
         cmd = "6;{x};{y};{w};{h}\n4;\n3;\n".format(
                 x = int((start_x - 0.2) * fontw),
-                y = int((start_y + 0.6) * fonth),
+                # (for tmux top status line)
+                # y = int((start_y + 0.6) * fonth),
+                y = int((start_y - 0.4) * fonth),
                 w = int((width + 0.4) * fontw),
-                h = int((height - 0.6) * fonth))
+                # (for tmux top status line)
+                # h = int((height - 0.2) * fonth) + 1)
+                h = int((height + 0.6) * fonth) + 1)
 
         self.process.stdin.write(cmd)
         self.process.stdin.flush()
@@ -95,7 +99,9 @@ class W3MImageDisplayer(ImageDisplayer):
             raise ImgDisplayUnsupportedException()
 
         max_width_pixels = max_width * fontw
-        max_height_pixels = (max_height - 1) * fonth
+        # (for tmux top status line)
+        # max_height_pixels = int((max_height - 0.5) * fonth + 1)
+        max_height_pixels = int((max_height + 0.5) * fonth) + 1
 
         # get image size
         cmd = "5;{}\n".format(path)
@@ -120,7 +126,9 @@ class W3MImageDisplayer(ImageDisplayer):
 
         return "0;1;{x};{y};{w};{h};;;;;{filename}\n4;\n3;\n".format(
                 x = int((start_x - 0.2) * fontw),
-                y = int((start_y + 0.6) * fonth),
+                # (for tmux top status line)
+                # y = int((start_y + 0.6) * fonth),
+                y = int((start_y - 0.4) * fonth),
                 w = width,
                 h = height,
                 filename = path)