diff --git a/CHANGELOG.md b/CHANGELOG.md index 03749bba..c0440753 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# Unreleased + +- Key bindings for `ctrl_i` and `ctrl_[` in the config file are no longer + ignored and are now synonymous with `tab` and `esc`. (#444) +- The keystrokes `ctrl_h` and `backspace` can now be distinguished, which + allows the user to define separate key bindings in the config file. (#445) + # 2025/01/01: 0.13.0 - Improve nick matching to avoid highlighting message incorrectly. (#430) diff --git a/crates/libtiny_tui/src/key_map.rs b/crates/libtiny_tui/src/key_map.rs index 02ba4bcb..4a3cf347 100644 --- a/crates/libtiny_tui/src/key_map.rs +++ b/crates/libtiny_tui/src/key_map.rs @@ -212,7 +212,18 @@ impl<'de> Deserialize<'de> for MappedKey { } else if let Some(f_key) = parse_f_key(k2) { Key::CtrlF(f_key) } else { - Key::Ctrl(single_key(k2)?) + match single_key(k2)? { + // NOTE: The following special mappings are needed + // because, e.g., `Key::Ctrl('i')` is never generated + // by `term_input` since `ctrl_i` and `tab` send + // identical bytes and hence cannot be distinguished + // in a terminal app. Having the special mapping here + // allows the user to define a working key binding for + // `ctrl_i`, which would otherwise be ignored. + 'i' => Key::Tab, + '[' => Key::Esc, + other => Key::Ctrl(other), + } } } "shift" => {