From 9c3cb154d3140c63e869c9c750a535dc13502f75 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 25 Jan 2026 03:14:47 +0100 Subject: [PATCH] Revert "reader: Remove two more case-insensitive asserts" See following commits. This reverts commit 0778919e7f96f675b401a3c268df7cea15e68be4. --- src/reader/reader.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/reader/reader.rs b/src/reader/reader.rs index ffc720852..c2b782dd5 100644 --- a/src/reader/reader.rs +++ b/src/reader/reader.rs @@ -1645,6 +1645,10 @@ fn combine_command_and_autosuggestion( if !string_prefixes_string(line, autosuggestion) && line.len() < autosuggestion.len() { // We have an autosuggestion which is not a prefix of the command line, i.e. a case // disagreement. Decide whose case we want to use. + assert!(string_prefixes_string_case_insensitive( + line, + autosuggestion + )); // Here we do something funny: if the last token of the command line contains any uppercase // characters, we use its case. Otherwise we use the case of the autosuggestion. This // is an idea from issue #335. @@ -2003,6 +2007,11 @@ fn try_apply_edit_to_autosuggestion(&mut self, edit: &Edit) -> bool { // the autosuggestion. // This is also the main mechanism by which readline commands that don't change the command line // text avoid recomputing the autosuggestion. + assert!(string_prefixes_string_maybe_case_insensitive( + autosuggestion.icase, + &self.command_line.text()[autosuggestion.search_string_range.clone()], + &autosuggestion.text + )); let search_string_range = autosuggestion.search_string_range.clone(); // This is a heuristic with false negatives but that seems fine.