From 33a7172ee8f99a32a18ac627642831bbf9ac8523 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 2 Mar 2024 20:30:41 +0100 Subject: [PATCH] Revert to not inserting control characters from keyboard input As mentioned in the comment the historical behavior is because pressing unknown control characters like Ctrl+4 inserts confusing characters, so let's back out that part of b77d1d0e2 (Stop crashing on invalid Unicode input, 2024-02-27). We still have the code for rendering control characters, for pasted text, or text recalled from history. It is unclear whether we should strip those. Some terminals already strip control characters from pasted text -- but not all of them: see https://codeberg.org/dnkl/foot/pulls/312 for example which has a follow up called "Don't strip HT when pasting in non-bracketed mode". --- src/reader.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/reader.rs b/src/reader.rs index 43f0f0b6c..c44514087 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1844,6 +1844,10 @@ fn readline(&mut self, nchars: Option) -> Option { && zelf.active_edit_line().1.position() == 0 { // This character is skipped. + } else if c.is_control() { + // This can happen if the user presses a control char we don't recognize. No + // reason to report this to the user unless they've enabled debugging output. + FLOG!(reader, wgettext_fmt!("Unknown key binding 0x%X", c)); } else { // Regular character. let (elt, _el) = zelf.active_edit_line();