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.
This commit is contained in:
Johannes Altmanninger 2025-01-10 09:16:52 +01:00
parent f448ddd579
commit 411745ebce

View file

@ -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 {