From a7396838eb4d0f2138a2818050f42cce01c47258 Mon Sep 17 00:00:00 2001 From: Shotaro Fujimoto Date: Sun, 21 Jun 2015 13:27:53 +0900 Subject: w3mimagedisplay pu the image right place --- ranger/ext/img_display.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index 6af717b5..cdb3f3a5 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -75,10 +75,10 @@ class W3MImageDisplayer(ImageDisplayer): fontw, fonth = _get_font_dimensions() cmd = "6;{x};{y};{w};{h}\n4;\n3;\n".format( - x = start_x * fontw, - y = start_y * fonth, - w = (width + 1) * fontw, - h = height * fonth) + x = int((start_x - 0.2) * fontw), + y = int((start_y + 0.6) * fonth), + w = int((width + 0.4)* fontw), + h = int((height - 0.6) * fonth)) self.process.stdin.write(cmd) self.process.stdin.flush() @@ -95,7 +95,7 @@ class W3MImageDisplayer(ImageDisplayer): raise ImgDisplayUnsupportedException() max_width_pixels = max_width * fontw - max_height_pixels = max_height * fonth + max_height_pixels = (max_height - 1) * fonth # get image size cmd = "5;{}\n".format(path) @@ -119,8 +119,8 @@ class W3MImageDisplayer(ImageDisplayer): height = max_height_pixels return "0;1;{x};{y};{w};{h};;;;;{filename}\n4;\n3;\n".format( - x = start_x * fontw, - y = start_y * fonth, + x = int((start_x - 0.2) * fontw), + y = int((start_y + 0.6) * fonth), w = width, h = height, filename = path) -- cgit 1.4.1-2-gfad0 From 95a697e66ed57470b8aba68b637dfdf3ad541124 Mon Sep 17 00:00:00 2001 From: Shotaro Fujimoto Date: Sun, 21 Jun 2015 13:45:57 +0900 Subject: add space (PEP8) --- ranger/ext/img_display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index cdb3f3a5..699f04d9 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -77,7 +77,7 @@ 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), - w = int((width + 0.4)* fontw), + w = int((width + 0.4) * fontw), h = int((height - 0.6) * fonth)) self.process.stdin.write(cmd) -- cgit 1.4.1-2-gfad0 From 9909e16551da908f079bb12c10652e82cd109cbe Mon Sep 17 00:00:00 2001 From: Shotaro Fujimoto Date: Sun, 21 Jun 2015 14:36:10 +0900 Subject: use muximum height to display image (commented the setting for tmux top status bar user) --- ranger/ext/img_display.py | 16 ++++++++++++---- 1 file 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) -- cgit 1.4.1-2-gfad0 From 35dae7c6b524b8e0530ef58c10a0c2bda709082e Mon Sep 17 00:00:00 2001 From: Shotaro Fujimoto Date: Sun, 21 Jun 2015 15:15:37 +0900 Subject: work if "draw_border false" is setted commented out setting is for tmux's top_status_bar --- ranger/ext/img_display.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index a9d85282..b61c253f 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -76,13 +76,10 @@ class W3MImageDisplayer(ImageDisplayer): cmd = "6;{x};{y};{w};{h}\n4;\n3;\n".format( x = int((start_x - 0.2) * fontw), - # (for tmux top status line) - # y = int((start_y + 0.6) * fonth), - y = int((start_y - 0.4) * fonth), + y = start_y * fonth, + # y = int((start_y + 1) * fonth), # (for tmux top status bar) w = int((width + 0.4) * fontw), - # (for tmux top status line) - # h = int((height - 0.2) * fonth) + 1) - h = int((height + 0.6) * fonth) + 1) + h = height * fonth + 1) self.process.stdin.write(cmd) self.process.stdin.flush() @@ -99,9 +96,7 @@ class W3MImageDisplayer(ImageDisplayer): raise ImgDisplayUnsupportedException() max_width_pixels = max_width * fontw - # (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 + max_height_pixels = max_height * fonth - 2 # get image size cmd = "5;{}\n".format(path) @@ -126,9 +121,8 @@ class W3MImageDisplayer(ImageDisplayer): return "0;1;{x};{y};{w};{h};;;;;{filename}\n4;\n3;\n".format( x = int((start_x - 0.2) * fontw), - # (for tmux top status line) - # y = int((start_y + 0.6) * fonth), - y = int((start_y - 0.4) * fonth), + y = start_y * fonth, + # y = (start_y + 1) * fonth, # (for tmux top status bar) w = width, h = height, filename = path) -- cgit 1.4.1-2-gfad0 From be22869e4e5b915d80186928ff22cca4a6f2309c Mon Sep 17 00:00:00 2001 From: ssh0 Date: Mon, 22 Jun 2015 22:38:40 +0900 Subject: shrink height for tmux's top status bar (commented part) --- ranger/ext/img_display.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py index b61c253f..d0a371f4 100644 --- a/ranger/ext/img_display.py +++ b/ranger/ext/img_display.py @@ -80,6 +80,7 @@ class W3MImageDisplayer(ImageDisplayer): # y = int((start_y + 1) * fonth), # (for tmux top status bar) w = int((width + 0.4) * fontw), h = height * fonth + 1) + # h = (height - 1) * fonth + 1) # (for tmux top status bar) self.process.stdin.write(cmd) self.process.stdin.flush() @@ -97,6 +98,8 @@ class W3MImageDisplayer(ImageDisplayer): max_width_pixels = max_width * fontw max_height_pixels = max_height * fonth - 2 + # (for tmux top status bar) + # max_height_pixels = (max_height - 1) * fonth - 2 # get image size cmd = "5;{}\n".format(path) -- cgit 1.4.1-2-gfad0