From 652996124d9d90892da2926b818a55dc31b57bc1 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Mon, 10 Jun 2024 17:14:13 +0200 Subject: [PATCH] reader: Remove a panic The special input functions self-insert, self-insert-not-first, and and or used to be handled by inputter_t::readch, but they aren't anymore with `commandline -f`. I am unsure if these *would* have worked, I can't come up with a use. So, for now, do nothing instead of panicking. --- src/reader.rs | 3 ++- tests/pexpects/bind.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/reader.rs b/src/reader.rs index 01cef7fa8..0945cdf5e 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -3172,7 +3172,8 @@ impl ReaderData { self.parser().libdata_mut().is_repaint = false; } rl::SelfInsert | rl::SelfInsertNotFirst | rl::FuncAnd | rl::FuncOr => { - panic!("should have been handled by inputter_t::readch"); + // This can be reached via `commandline -f and` etc + // panic!("should have been handled by inputter_t::readch"); } } } diff --git a/tests/pexpects/bind.py b/tests/pexpects/bind.py index 9636a0cf1..75ef600cc 100644 --- a/tests/pexpects/bind.py +++ b/tests/pexpects/bind.py @@ -375,6 +375,10 @@ expect_prompt("foobar") # This should do nothing instead of crash sendline("commandline -f backward-jump") expect_prompt() +sendline("commandline -f self-insert") +expect_prompt() +sendline("commandline -f and") +expect_prompt() # Check that the builtin version of `exit` works # (for obvious reasons this MUST BE LAST)