+27
-2
@@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Current protocol version. Bumped when wire format changes incompatibly.
|
||||
pub const PROTOCOL_VERSION: u32 = 17;
|
||||
pub const PROTOCOL_VERSION: u32 = 18;
|
||||
|
||||
/// Maximum allowed frame payload size (2 MB). Frames larger than this are
|
||||
/// rejected to prevent denial-of-service via oversized length prefixes.
|
||||
@@ -116,6 +116,9 @@ pub enum ClientInputEvent {
|
||||
modifiers: u8,
|
||||
kind: ClientKeyKind,
|
||||
},
|
||||
Text {
|
||||
codepoint: char,
|
||||
},
|
||||
Mouse {
|
||||
kind: ClientMouseKind,
|
||||
column: u16,
|
||||
@@ -251,7 +254,7 @@ impl ClientMouseKind {
|
||||
}
|
||||
|
||||
impl ClientInputEvent {
|
||||
#[cfg(windows)]
|
||||
#[cfg(any(windows, test))]
|
||||
pub(crate) fn from_crossterm(event: crossterm::event::Event) -> Option<Self> {
|
||||
match event {
|
||||
crossterm::event::Event::Key(key) => Some(Self::Key {
|
||||
@@ -285,6 +288,13 @@ impl ClientInputEvent {
|
||||
)
|
||||
.with_kind(kind.to_crossterm()),
|
||||
),
|
||||
Self::Text { codepoint } => crate::raw_input::RawInputEvent::Key(
|
||||
crate::input::TerminalKey::new(
|
||||
crossterm::event::KeyCode::Char(*codepoint),
|
||||
crossterm::event::KeyModifiers::empty(),
|
||||
)
|
||||
.as_text_commit(),
|
||||
),
|
||||
Self::Mouse {
|
||||
kind,
|
||||
column,
|
||||
@@ -657,6 +667,12 @@ pub enum ServerMessage {
|
||||
enabled: bool,
|
||||
},
|
||||
|
||||
/// Whether the focused terminal requests Kitty report-all keyboard input.
|
||||
KittyKeyboardReportAll {
|
||||
/// True only while the focused pane requests `REPORT_ALL_KEYS_AS_ESCAPE_CODES`.
|
||||
enabled: bool,
|
||||
},
|
||||
|
||||
/// Apply the prefix-mode ASCII input-source change on the foreground client.
|
||||
/// `active = true` → switch to an ASCII-capable source (saving the current one);
|
||||
/// `active = false` → restore the saved source.
|
||||
@@ -1412,6 +1428,15 @@ mod tests {
|
||||
assert_eq!(msg, decoded);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn server_kitty_keyboard_report_all_roundtrip() {
|
||||
let msg = ServerMessage::KittyKeyboardReportAll { enabled: true };
|
||||
let encoded = bincode::serde::encode_to_vec(&msg, bincode::config::standard()).unwrap();
|
||||
let (decoded, _): (ServerMessage, _) =
|
||||
bincode::serde::decode_from_slice(&encoded, bincode::config::standard()).unwrap();
|
||||
assert_eq!(msg, decoded);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn server_prefix_input_source_roundtrip() {
|
||||
for active in [true, false] {
|
||||
|
||||
Reference in New Issue
Block a user