diff options
author | Canop <cano.petrole@gmail.com> | 2020-11-26 21:25:08 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-11-26 21:25:08 +0100 |
commit | d0780bc4560e050a04293b941f1e44cb067eefc0 (patch) | |
tree | 347ac149dd010bacae70b03d00c602e2d5f501f9 /src/display | |
parent | 9785535f80573a9b00d2ce738f0c5a8df81db392 (diff) |
high definition preview images on kitty
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/cell_size.rs (renamed from src/display/terminal_dimensions.rs) | 6 | ||||
-rw-r--r-- | src/display/mod.rs | 14 |
2 files changed, 7 insertions, 13 deletions
diff --git a/src/display/terminal_dimensions.rs b/src/display/cell_size.rs index e90ae89..d7a077e 100644 --- a/src/display/terminal_dimensions.rs +++ b/src/display/cell_size.rs @@ -8,7 +8,11 @@ use { std::io, }; - +/// find and return the size of a cell (a char location) in pixels +/// as (width, height). +/// Many terminals don't fill this information correctly, so an +/// error is expected (it works on kitty, where I use the data +/// to compute the rendering dimensions of images) #[cfg(unix)] pub fn cell_size_in_pixels() -> io::Result<(u32, u32)> { // see http://www.delorie.com/djgpp/doc/libc/libc_495.html diff --git a/src/display/mod.rs b/src/display/mod.rs index c075b0c..5db1f1e 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -30,7 +30,7 @@ pub mod flags_display; pub mod status_line; mod matched_string; mod screen; -mod terminal_dimensions; +mod cell_size; #[cfg(not(any(target_family="windows",target_os="android")))] mod permissions; @@ -44,7 +44,7 @@ pub use { git_status_display::GitStatusDisplay, matched_string::MatchedString, screen::Screen, - terminal_dimensions::*, + cell_size::*, }; use { crate::{ @@ -84,16 +84,6 @@ pub fn writer() -> W { std::io::BufWriter::new(std::io::stderr()) } -// /// the type used by all GUI writing functions -// //pub type W = std::io::BufWriter<std::io::Stderr>; -// pub type W = std::io::Stdout; -// -// /// return the writer used by the application -// pub fn writer() -> W { -// std::io::stdout() -// } - - pub fn fill_bg( w: &mut W, len: usize, |