Skip to content

Commit

Permalink
Automatically enable csiu/kitty mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dustletter committed Apr 28, 2023
1 parent f725f4c commit 58e5f0a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/tty/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const UNSUPPORTED_TERM: [&str; 3] = ["dumb", "cons25", "emacs"];

const BRACKETED_PASTE_ON: &str = "\x1b[?2004h";
const BRACKETED_PASTE_OFF: &str = "\x1b[?2004l";
const PUSH_KITTY_FLAGS: &str = "\x1b[>1u";
const POP_KITTY_FLAGS: &str = "\x1b[<u";

nix::ioctl_read_bad!(win_size, libc::TIOCGWINSZ, libc::winsize);

Expand Down Expand Up @@ -110,6 +112,7 @@ impl RawMode for PosixMode {
// disable bracketed paste
if let Some(out) = self.tty_out {
write_all(out, BRACKETED_PASTE_OFF)?;
write_all(out, POP_KITTY_FLAGS)?;
}
self.raw_mode.store(false, Ordering::SeqCst);
Ok(())
Expand Down Expand Up @@ -1395,6 +1398,8 @@ impl Term for PosixTerminal {

termios::tcsetattr(self.tty_in, SetArg::TCSADRAIN, &raw)?;

write_all(self.tty_out, PUSH_KITTY_FLAGS)?;

self.raw_mode.store(true, Ordering::SeqCst);
// enable bracketed paste
let out = if !self.enable_bracketed_paste {
Expand Down

0 comments on commit 58e5f0a

Please sign in to comment.