Rename the readline function for deleting active history item

history-pager-delete now also works for regular history search,
so rename it.
This commit is contained in:
Johannes Altmanninger 2025-01-10 09:09:35 +01:00
parent f8b245eb31
commit 7c539b9539
6 changed files with 13 additions and 6 deletions

View file

@ -240,7 +240,7 @@ The following special input functions are available:
``history-pager``
invoke the searchable pager on history (incremental search); or if the history pager is already active, search further backwards in time.
``history-pager-delete``
``history-delete``
permanently delete the current history item, either from the history pager or from an active up-arrow history search
``history-search-backward``

View file

@ -41,8 +41,8 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
# shift-tab does a tab complete followed by a search.
bind --preset $argv shift-tab complete-and-search
$legacy_bind --preset $argv -k btab complete-and-search
bind --preset $argv shift-delete history-pager-delete or backward-delete-char
$legacy_bind --preset $argv -k sdc history-pager-delete or backward-delete-char
bind --preset $argv shift-delete history-delete or backward-delete-char
$legacy_bind --preset $argv -k sdc history-delete or backward-delete-char
bind --preset $argv down down-or-search
$legacy_bind --preset $argv -k down down-or-search

View file

@ -172,7 +172,9 @@ const INPUT_FUNCTION_METADATA: &[InputFunctionMetadata] = &[
make_md(L!("forward-single-char"), ReadlineCmd::ForwardSingleChar),
make_md(L!("forward-token"), ReadlineCmd::ForwardToken),
make_md(L!("forward-word"), ReadlineCmd::ForwardWord),
make_md(L!("history-delete"), ReadlineCmd::HistoryDelete),
make_md(L!("history-pager"), ReadlineCmd::HistoryPager),
#[allow(deprecated)]
make_md(L!("history-pager-delete"), ReadlineCmd::HistoryPagerDelete),
make_md(L!("history-prefix-search-backward"), ReadlineCmd::HistoryPrefixSearchBackward),
make_md(L!("history-prefix-search-forward"), ReadlineCmd::HistoryPrefixSearchForward),

View file

@ -58,11 +58,13 @@ pub enum ReadlineCmd {
BackwardToken,
NextdOrForwardWord,
PrevdOrBackwardWord,
HistoryDelete,
HistorySearchBackward,
HistorySearchForward,
HistoryPrefixSearchBackward,
HistoryPrefixSearchForward,
HistoryPager,
#[deprecated]
HistoryPagerDelete,
DeleteChar,
BackwardDeleteChar,

View file

@ -2971,7 +2971,8 @@ impl<'a> Reader<'a> {
};
self.insert_string(EditableLineTag::SearchField, &search_string);
}
rl::HistoryPagerDelete => {
#[allow(deprecated)]
rl::HistoryDelete | rl::HistoryPagerDelete => {
// Also applies to ordinary history search.
let is_history_search = !self.history_search.is_at_end();
let is_autosuggestion = self.is_at_autosuggestion();
@ -5470,6 +5471,7 @@ fn command_ends_paging(c: ReadlineCmd, focused_on_search_field: bool) -> bool {
fn command_ends_history_search(c: ReadlineCmd) -> bool {
#[allow(non_camel_case_types)]
type rl = ReadlineCmd;
#[allow(deprecated)]
!matches!(
c,
rl::HistoryPrefixSearchBackward
@ -5478,6 +5480,7 @@ fn command_ends_history_search(c: ReadlineCmd) -> bool {
| rl::HistorySearchForward
| rl::HistoryTokenSearchBackward
| rl::HistoryTokenSearchForward
| rl::HistoryDelete
| rl::HistoryPagerDelete
| rl::BeginningOfHistory
| rl::EndOfHistory

View file

@ -3,11 +3,11 @@
# disable on github actions because it's flakey
#REQUIRES: test -z "$CI"
# The default history-pager-delete binding is shift-delete which
# The default history-delete binding is shift-delete which
# won't work on terminals that don't support CSI u, so rebind.
set -g isolated_tmux_fish_extra_args -C '
set -g fish_autosuggestion_enabled 0
bind alt-d history-pager-delete or backward-delete-char
bind alt-d history-delete or backward-delete-char
'
isolated-tmux-start