mirror of
https://github.com/wez/wezterm.git
synced 2024-09-19 02:37:51 +03:00
term: add enable_kitty_keyboard config option
It's been reported that something is funky with nvim, so default this to false for now until I have time to debug it. refs: https://github.com/wez/wezterm/issues/1141
This commit is contained in:
parent
5385c94314
commit
61510b8393
@ -160,6 +160,8 @@ pub struct Config {
|
||||
|
||||
#[dynamic(default = "default_true")]
|
||||
pub enable_kitty_graphics: bool,
|
||||
#[dynamic(default)]
|
||||
pub enable_kitty_keyboard: bool,
|
||||
|
||||
/// Specifies the width of a new window, expressed in character cells
|
||||
#[dynamic(default = "default_initial_cols")]
|
||||
|
@ -67,6 +67,10 @@ impl wezterm_term::TerminalConfiguration for TermConfig {
|
||||
self.configuration().enable_kitty_graphics
|
||||
}
|
||||
|
||||
fn enable_kitty_keyboard(&self) -> bool {
|
||||
self.configuration().enable_kitty_keyboard
|
||||
}
|
||||
|
||||
fn canonicalize_pasted_newlines(&self) -> wezterm_term::config::NewlineCanon {
|
||||
match self.configuration().canonicalize_pasted_newlines {
|
||||
None => wezterm_term::config::NewlineCanon::default(),
|
||||
|
@ -14,7 +14,7 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
#### New
|
||||
* [background](config/lua/config/background.md) option for rich background compositing and parallax scrolling effects.
|
||||
* Added [docs for the cli](cli/general.md)
|
||||
* Support for the [Kitty Keyboard Protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol)
|
||||
* Support for the [Kitty Keyboard Protocol](https://sw.kovidgoyal.net/kitty/keyboard-protocol). Use `enable_kitty_keyboard=true` to enable it.
|
||||
* New [wezterm.mux](config/lua/wezterm.mux/index.md) module, [gui-startup](config/lua/gui-events/gui-startup.md) and [mux-startup](config/lua/mux-events/mux-startup.md) events for spawning programs into your preferred arrangement when wezterm starts. [#674](https://github.com/wez/wezterm/issues/674)
|
||||
* ssh client now supports `BindAddress`. Thanks to [@gpanders](https://github.com/gpanders)! [#1875](https://github.com/wez/wezterm/pull/1875)
|
||||
* [PaneInformation.domain_name](config/lua/PaneInformation.md) and [pane:get_domain_name()](config/lua/pane/get_domain_name.md) which return the name of the domain with which a pane is associated. [#1881](https://github.com/wez/wezterm/issues/1881)
|
||||
|
@ -175,6 +175,10 @@ pub trait TerminalConfiguration: std::fmt::Debug {
|
||||
false
|
||||
}
|
||||
|
||||
fn enable_kitty_keyboard(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
/// The default unicode version to assume.
|
||||
/// This affects how the width of certain sequences is interpreted.
|
||||
/// At the time of writing, we default to 9 even though the current
|
||||
|
@ -432,34 +432,38 @@ impl<'a> Performer<'a> {
|
||||
.replace(ParagraphDirectionHint::RightToLeft);
|
||||
}
|
||||
CSI::Keyboard(Keyboard::SetKittyState { flags, mode }) => {
|
||||
let current_flags = match self.screen().keyboard_stack.last() {
|
||||
Some(KeyboardEncoding::Kitty(flags)) => *flags,
|
||||
_ => KittyKeyboardFlags::NONE,
|
||||
};
|
||||
let flags = match mode {
|
||||
KittyKeyboardMode::AssignAll => flags,
|
||||
KittyKeyboardMode::SetSpecified => current_flags | flags,
|
||||
KittyKeyboardMode::ClearSpecified => current_flags - flags,
|
||||
};
|
||||
self.screen_mut().keyboard_stack.pop();
|
||||
self.screen_mut()
|
||||
.keyboard_stack
|
||||
.push(KeyboardEncoding::Kitty(flags));
|
||||
if self.config.enable_kitty_keyboard() {
|
||||
let current_flags = match self.screen().keyboard_stack.last() {
|
||||
Some(KeyboardEncoding::Kitty(flags)) => *flags,
|
||||
_ => KittyKeyboardFlags::NONE,
|
||||
};
|
||||
let flags = match mode {
|
||||
KittyKeyboardMode::AssignAll => flags,
|
||||
KittyKeyboardMode::SetSpecified => current_flags | flags,
|
||||
KittyKeyboardMode::ClearSpecified => current_flags - flags,
|
||||
};
|
||||
self.screen_mut().keyboard_stack.pop();
|
||||
self.screen_mut()
|
||||
.keyboard_stack
|
||||
.push(KeyboardEncoding::Kitty(flags));
|
||||
}
|
||||
}
|
||||
CSI::Keyboard(Keyboard::PushKittyState { flags, mode }) => {
|
||||
let current_flags = match self.screen().keyboard_stack.last() {
|
||||
Some(KeyboardEncoding::Kitty(flags)) => *flags,
|
||||
_ => KittyKeyboardFlags::NONE,
|
||||
};
|
||||
let flags = match mode {
|
||||
KittyKeyboardMode::AssignAll => flags,
|
||||
KittyKeyboardMode::SetSpecified => current_flags | flags,
|
||||
KittyKeyboardMode::ClearSpecified => current_flags - flags,
|
||||
};
|
||||
let screen = self.screen_mut();
|
||||
screen.keyboard_stack.push(KeyboardEncoding::Kitty(flags));
|
||||
if screen.keyboard_stack.len() > 128 {
|
||||
screen.keyboard_stack.remove(0);
|
||||
if self.config.enable_kitty_keyboard() {
|
||||
let current_flags = match self.screen().keyboard_stack.last() {
|
||||
Some(KeyboardEncoding::Kitty(flags)) => *flags,
|
||||
_ => KittyKeyboardFlags::NONE,
|
||||
};
|
||||
let flags = match mode {
|
||||
KittyKeyboardMode::AssignAll => flags,
|
||||
KittyKeyboardMode::SetSpecified => current_flags | flags,
|
||||
KittyKeyboardMode::ClearSpecified => current_flags - flags,
|
||||
};
|
||||
let screen = self.screen_mut();
|
||||
screen.keyboard_stack.push(KeyboardEncoding::Kitty(flags));
|
||||
if screen.keyboard_stack.len() > 128 {
|
||||
screen.keyboard_stack.remove(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
CSI::Keyboard(Keyboard::PopKittyState(n)) => {
|
||||
@ -468,12 +472,14 @@ impl<'a> Performer<'a> {
|
||||
}
|
||||
}
|
||||
CSI::Keyboard(Keyboard::QueryKittySupport) => {
|
||||
let flags = match self.screen().keyboard_stack.last() {
|
||||
Some(KeyboardEncoding::Kitty(flags)) => *flags,
|
||||
_ => KittyKeyboardFlags::NONE,
|
||||
};
|
||||
write!(self.writer, "\x1b[?{}u", flags.bits()).ok();
|
||||
self.writer.flush().ok();
|
||||
if self.config.enable_kitty_keyboard() {
|
||||
let flags = match self.screen().keyboard_stack.last() {
|
||||
Some(KeyboardEncoding::Kitty(flags)) => *flags,
|
||||
_ => KittyKeyboardFlags::NONE,
|
||||
};
|
||||
write!(self.writer, "\x1b[?{}u", flags.bits()).ok();
|
||||
self.writer.flush().ok();
|
||||
}
|
||||
}
|
||||
CSI::Keyboard(Keyboard::ReportKittyState(_)) => {
|
||||
// This is a response to QueryKittySupport and it is invalid for us
|
||||
|
Loading…
Reference in New Issue
Block a user