diff --git a/README.md b/README.md index 0311ae21..4a45bc38 100644 --- a/README.md +++ b/README.md @@ -147,17 +147,18 @@ If you want to use your own config, copy the [config folder](./config/preset) to ## Image Preview -| Platform | Protocol | Support | -| ------------- | -------------------------------------------------------------------------------- | --------------------- | -| Kitty | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in | -| WezTerm | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in | -| Konsole | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in | -| iTerm2 | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in | -| Hyper | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in | -| foot | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in | -| Black Box | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in | -| X11 / Wayland | Window system protocol | ☑️ Überzug++ required | -| Fallback | [Chafa](https://hpjansson.org/chafa/) | ☑️ Überzug++ required | +| Platform | Protocol | Support | +| ----------------- | -------------------------------------------------------------------------------- | --------------------- | +| Kitty | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in | +| WezTerm | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in | +| Konsole | [Terminal graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) | ✅ Built-in | +| iTerm2 | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in | +| Mintty (Git Bash) | [Inline images protocol](https://iterm2.com/documentation-images.html) | ✅ Built-in | +| Hyper | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in | +| foot | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in | +| Black Box | [Sixel graphics format](https://www.vt100.net/docs/vt3xx-gp/chapter14.html) | ✅ Built-in | +| X11 / Wayland | Window system protocol | ☑️ Überzug++ required | +| Fallback | [Chafa](https://hpjansson.org/chafa/) | ☑️ Überzug++ required | Yazi automatically selects the appropriate preview method for you, based on the priority from top to bottom. That's relying on the `$TERM`, `$TERM_PROGRAM`, and `$XDG_SESSION_TYPE` variables, make sure you don't overwrite them by mistake! diff --git a/config/src/preview/adaptor.rs b/config/src/preview/adaptor.rs index bfdc521e..ebbcc865 100644 --- a/config/src/preview/adaptor.rs +++ b/config/src/preview/adaptor.rs @@ -31,6 +31,7 @@ impl Default for PreviewAdaptor { "BlackBox" => return Self::Sixel, "vscode" => return Self::Sixel, "Hyper" => return Self::Sixel, + "mintty" => return Self::Iterm2, _ => {} } match env::var("XDG_SESSION_TYPE").unwrap_or_default().as_str() { diff --git a/cspell.json b/cspell.json index 2003b2e3..c26e3940 100644 --- a/cspell.json +++ b/cspell.json @@ -1 +1 @@ -{"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","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord"],"version":"0.2"} +{"language":"en","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","pkgs","paru","unarchiver","pdftoppm","poppler","prebuild","singlefile","jpegopt","EXIF","rustfmt","mktemp","nanos","xclip","xsel","natord","Mintty","nixos","nixpkgs"],"version":"0.2","flagWords":[]} diff --git a/shared/src/term/cursor.rs b/shared/src/term/cursor.rs index 1d73ef4e..5d96a82e 100644 --- a/shared/src/term/cursor.rs +++ b/shared/src/term/cursor.rs @@ -24,8 +24,16 @@ impl Term { { #[cfg(target_os = "windows")] { + use std::{thread, time::Duration}; + use crossterm::cursor::{Hide, Show}; queue!(&mut stdout, SavePosition, MoveTo(x, y), Show)?; + + // I really don't want to add this, + // but on Windows the cursor position will not synchronize in time occasionally + stdout.flush()?; + thread::sleep(Duration::from_millis(1)); + let result = cb(&mut stdout); queue!(&mut stdout, Hide, RestorePosition)?; stdout.flush()?;