From 7e008bb0396eb130c4bc4fb62240566bf6feda9f Mon Sep 17 00:00:00 2001 From: Thomas Linford Date: Wed, 9 Mar 2022 21:21:15 +0100 Subject: fix(compatibility): home and end in cursor keys mode (#1190) --- zellij-client/src/stdin_handler.rs | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'zellij-client/src') diff --git a/zellij-client/src/stdin_handler.rs b/zellij-client/src/stdin_handler.rs index 3abb497a1..965100f87 100644 --- a/zellij-client/src/stdin_handler.rs +++ b/zellij-client/src/stdin_handler.rs @@ -1,34 +1,10 @@ use crate::os_input_output::ClientOsApi; use crate::InputInstruction; -use std::collections::HashMap; -use terminfo::{capability as cap, Database as TerminfoDatabase}; use termion::input::TermReadEventsAndRaw; use zellij_utils::channels::SenderWithContext; use zellij_utils::input::mouse::MouseEvent; use zellij_utils::termion; -fn keys_to_adjust() -> HashMap, Vec> { - let mut keys_to_adjust = HashMap::new(); - if let Ok(terminfo_db) = TerminfoDatabase::from_env() { - // TODO: there might be more adjustments we can do here, but I held off on them because I'm - // not sure they're a thing in these modern times. It should be pretty straightforward to - // implement them if they are... - if let Some(adjusted_home_key) = terminfo_db - .get::() - .and_then(|k| k.expand().to_vec().ok()) - { - keys_to_adjust.insert(vec![27, 91, 72], adjusted_home_key); - } - if let Some(adjusted_end_key) = terminfo_db - .get::() - .and_then(|k| k.expand().to_vec().ok()) - { - keys_to_adjust.insert(vec![27, 91, 70], adjusted_end_key); - } - } - keys_to_adjust -} - pub(crate) fn stdin_loop( os_input: Box, send_input_instructions: SenderWithContext, @@ -38,7 +14,6 @@ pub(crate) fn stdin_loop( let bracketed_paste_start = termion::event::Event::Unsupported(vec![27, 91, 50, 48, 48, 126]); // \u{1b}[200~ let bracketed_paste_end = termion::event::Event::Unsupported(vec![27, 91, 50, 48, 49, 126]); // \u{1b}[201~ let csi_mouse_sgr_start = vec![27, 91, 60]; - let adjusted_keys = keys_to_adjust(); for key_result in os_input.get_stdin_reader().events_and_raw() { let (key_event, mut raw_bytes) = key_result.unwrap(); @@ -59,7 +34,6 @@ pub(crate) fn stdin_loop( continue; } - let raw_bytes = adjusted_keys.get(&raw_bytes).cloned().unwrap_or(raw_bytes); if let termion::event::Event::Mouse(me) = key_event { let mouse_event = zellij_utils::input::mouse::MouseEvent::from(me); if let MouseEvent::Hold(_) = mouse_event { -- cgit v1.2.3