diff --git a/adaptor/src/sixel.rs b/adaptor/src/sixel.rs index 9110553f..4763094f 100644 --- a/adaptor/src/sixel.rs +++ b/adaptor/src/sixel.rs @@ -40,7 +40,7 @@ impl Sixel { let nq = NeuQuant::new(10, 256 - alpha as usize, &img); let mut buf: Vec = Vec::with_capacity(1 << 16); - write!(buf, "\x1bP0;0;8q\"1;1;{};{}", img.width(), img.height())?; + write!(buf, "\x1bP0;1;8q\"1;1;{};{}", img.width(), img.height())?; // Palette for (i, c) in nq.color_map_rgba().chunks(4).enumerate() { diff --git a/app/src/app.rs b/app/src/app.rs index 821d549b..3ace3841 100644 --- a/app/src/app.rs +++ b/app/src/app.rs @@ -67,6 +67,7 @@ impl App { fn dispatch_resize(&mut self) { self.cx.manager.current_mut().set_page(true); + self.cx.manager.active_mut().preview_reset_image(); self.cx.manager.preview(self.cx.image_layer()); emit!(Render); } diff --git a/config/src/preview/adaptor.rs b/config/src/preview/adaptor.rs index f961026f..2f5580e7 100644 --- a/config/src/preview/adaptor.rs +++ b/config/src/preview/adaptor.rs @@ -22,12 +22,12 @@ impl Default for PreviewAdaptor { } match env::var("TERM").unwrap_or_default().as_str() { "xterm-kitty" => return Self::Kitty, - "wezterm" => return Self::Kitty, "foot" => return Self::Sixel, _ => {} } match env::var("TERM_PROGRAM").unwrap_or_default().as_str() { "iTerm.app" => return Self::Iterm2, + "WezTerm" => return Self::Kitty, "Hyper" => return Self::Sixel, _ => {} } diff --git a/core/src/manager/manager.rs b/core/src/manager/manager.rs index edf93b07..744a4a9b 100644 --- a/core/src/manager/manager.rs +++ b/core/src/manager/manager.rs @@ -59,7 +59,7 @@ impl Manager { }; if !show_image { - self.active_mut().preview.reset_image(); + self.active_mut().preview_reset_image(); } if hovered.meta.is_dir() { diff --git a/core/src/manager/tab.rs b/core/src/manager/tab.rs index aa3cd018..dbb2cfa6 100644 --- a/core/src/manager/tab.rs +++ b/core/src/manager/tab.rs @@ -221,6 +221,7 @@ impl Tab { drop(mem::replace(&mut self.current, rep)); } + self.preview_reset_image(); emit!(Refresh); true } @@ -279,4 +280,7 @@ impl Tab { #[inline] pub fn preview(&self) -> &Preview { &self.preview } + + #[inline] + pub fn preview_reset_image(&mut self) -> bool { self.preview.reset_image() } } diff --git a/core/src/manager/tabs.rs b/core/src/manager/tabs.rs index 2e7f8682..d97c569f 100644 --- a/core/src/manager/tabs.rs +++ b/core/src/manager/tabs.rs @@ -14,9 +14,8 @@ pub struct Tabs { impl Tabs { pub fn new() -> Self { - let tabs = Self { idx: 0, items: vec![Tab::new(&MANAGER.cwd)] }; - - emit!(Refresh); + let mut tabs = Self { idx: usize::MAX, items: vec![Tab::new(&MANAGER.cwd)] }; + tabs.set_idx(0); tabs } @@ -78,6 +77,7 @@ impl Tabs { #[inline] fn set_idx(&mut self, idx: usize) { self.idx = idx; + self.active_mut().preview_reset_image(); emit!(Refresh); } } diff --git a/cspell.json b/cspell.json index d6f8dc01..b96f1a26 100644 --- a/cspell.json +++ b/cspell.json @@ -1 +1 @@ -{"flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty"],"version":"0.2","language":"en"} +{"language":"en","flagWords":[],"words":["Punct","KEYMAP","splitn","crossterm","YAZI","unar","peekable","ratatui","syntect","pbpaste","pbcopy","ffmpegthumbnailer","oneshot","Posix","Lsar","XADDOS","zoxide","cands","Deque","precache","imageops","IFBLK","IFCHR","IFDIR","IFIFO","IFLNK","IFMT","IFSOCK","IRGRP","IROTH","IRUSR","ISGID","ISUID","ISVTX","IWGRP","IWOTH","IWUSR","IXGRP","IXOTH","IXUSR","libc","winsize","TIOCGWINSZ","xpixel","ypixel","ioerr","appender","Catppuccin","macchiato","gitmodules","Dotfiles","bashprofile","vimrc","flac","webp","exiftool","mediainfo","ripgrep","nvim","indexmap","indexmap","unwatch","canonicalize","serde","fsevent","Ueberzug","iterm","wezterm","sixel","chafa","ueberzugpp","️ Überzug","️ Überzug","Konsole","Alacritty","Überzug"],"version":"0.2"}