From 411745ebce44693d8dca3d2aed4bfcd700aac076 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Fri, 10 Jan 2025 09:16:52 +0100 Subject: [PATCH] shift-delete to only delete from history if cursor at autosuggestion If there is no history search or autosuggestion, shift-delete acts as backspace, matching native macOS behavior. I'm not sure if we want to keep that amount of overloaded behavior, but let's assume so for now. If that assumption holds, it may be confusing that shift-delete deletes the autosuggestion if the cursor is here echo some command with autosuggstion ^ So let's only do that if the cursor is actually at the autosuggestion, I guess. --- src/reader.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reader.rs b/src/reader.rs index f4e26e79b..1d201a09b 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -2974,7 +2974,7 @@ impl<'a> Reader<'a> { rl::HistoryPagerDelete => { // Also applies to ordinary history search. let is_history_search = !self.history_search.is_at_end(); - let is_autosuggestion = self.is_at_line_with_autosuggestion(); + let is_autosuggestion = self.is_at_autosuggestion(); if is_history_search || is_autosuggestion { self.input_data.function_set_status(true); if is_autosuggestion && !self.autosuggestion.is_from_history {