Skip to content

Commit 33a7172

Browse files
committed
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 b77d1d0 (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".
1 parent 2a4e776 commit 33a7172

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/reader.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,10 @@ impl ReaderData {
18441844
&& zelf.active_edit_line().1.position() == 0
18451845
{
18461846
// This character is skipped.
1847+
} else if c.is_control() {
1848+
// This can happen if the user presses a control char we don't recognize. No
1849+
// reason to report this to the user unless they've enabled debugging output.
1850+
FLOG!(reader, wgettext_fmt!("Unknown key binding 0x%X", c));
18471851
} else {
18481852
// Regular character.
18491853
let (elt, _el) = zelf.active_edit_line();

0 commit comments

Comments
 (0)