Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl Reedline {
buffer_editor: None,
cursor_shapes: None,
bracketed_paste: BracketedPasteGuard::default(),
kitty_protocol: KittyProtocolGuard::default(),
kitty_protocol: KittyProtocolGuard::new(),
#[cfg(feature = "external_printer")]
external_printer: None,
}
Expand Down
12 changes: 10 additions & 2 deletions src/terminal_extensions/kitty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,23 @@ use crossterm::{event, execute};
/// * [dte text editor](https://gitlab.com/craigbarnes/dte/-/issues/138)
///
/// Refer to <https://sw.kovidgoyal.net/kitty/keyboard-protocol/> if you're curious.
#[derive(Default)]
pub(crate) struct KittyProtocolGuard {
enabled: bool,
active: bool,
support_kitty_protocol: bool,
}

impl KittyProtocolGuard {
pub fn new() -> Self {
Self {
support_kitty_protocol: super::kitty_protocol_available(),
enabled: false,
active: false,
}
}

pub fn set(&mut self, enable: bool) {
self.enabled = enable && super::kitty_protocol_available();
self.enabled = enable && self.support_kitty_protocol;
}
pub fn enter(&mut self) {
if self.enabled && !self.active {
Expand Down