File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
src/onefetch/image_backends Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -77,8 +77,10 @@ impl super::ImageBackend for SixelBackend {
7777 ioctl ( STDOUT_FILENO , TIOCGWINSZ , & tty_size) ;
7878 tty_size
7979 } ;
80- let width_ratio = tty_size. ws_col as f64 / tty_size. ws_xpixel as f64 ;
81- let height_ratio = tty_size. ws_row as f64 / tty_size. ws_ypixel as f64 ;
80+ let cw = tty_size. ws_xpixel / tty_size. ws_col ;
81+ let lh = tty_size. ws_ypixel / tty_size. ws_row ;
82+ let width_ratio = 1.0 / cw as f64 ;
83+ let height_ratio = 1.0 / lh as f64 ;
8284
8385 // resize image to fit the text height with the Lanczos3 algorithm
8486 let image = image. resize (
@@ -152,7 +154,7 @@ impl super::ImageBackend for SixelBackend {
152154 }
153155 image_data. extend ( b"\x1B \\ " ) ;
154156
155- image_data. extend ( format ! ( "\x1B [{}A" , image_rows as u32 + 2 ) . as_bytes ( ) ) ; // move cursor to top-left corner
157+ image_data. extend ( format ! ( "\x1B [{}A" , image_rows as u32 ) . as_bytes ( ) ) ; // move cursor to top-left corner
156158 image_data. extend ( format ! ( "\x1B [{}C" , image_columns as u32 + 1 ) . as_bytes ( ) ) ; // move cursor to top-right corner of image
157159 let mut i = 0 ;
158160 for line in & lines {
You can’t perform that action at this time.
0 commit comments