mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-08 22:53:59 +08:00
Make new ctrl-c behavior "clear-commandline"
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run
And leave the old behavior under the name "cancel-commandline". This renames "cancel-commandline-traditional" back to "cancel-commandline", so the old name triggers the old behavior. Fixes #10935
This commit is contained in:
parent
8e141070b2
commit
806734cc56
|
@ -12,6 +12,8 @@ Changes since 4.0b1
|
|||
- Remove the completions for ``dust`` because it conflicted with the Debian/Ubuntu package (:issue:`10922`).
|
||||
- Improve the documentation style for narrow interfaces (like phones) (:issue:`10942`).
|
||||
- Add debug information back to cmake builds with the "RelWithDebInfo" profile (:issue:`10959`).
|
||||
- the :kbd:`ctrl-c` binding now calls a new bind function called "clear-commandline",
|
||||
the old behavior that leaves a "^C" marker is available as "cancel-commandline" (:issue:`10935`)
|
||||
|
||||
|
||||
fish 4.0b1 (released December 17, 2024)
|
||||
|
|
|
@ -170,6 +170,9 @@ The following special input functions are available:
|
|||
``capitalize-word``
|
||||
make the current word begin with a capital letter
|
||||
|
||||
``clear-commandline``
|
||||
empty the entire commandline
|
||||
|
||||
``clear-screen``
|
||||
clears the screen and redraws the prompt. if the terminal doesn't support clearing the screen it is the same as ``repaint``.
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
|||
bind --preset $argv alt-o __fish_preview_current_file
|
||||
bind --preset $argv alt-w __fish_whatis_current_token
|
||||
bind --preset $argv ctrl-l clear-screen
|
||||
bind --preset $argv ctrl-c cancel-commandline
|
||||
bind --preset $argv ctrl-c clear-commandline
|
||||
bind --preset $argv ctrl-u backward-kill-line
|
||||
bind --preset $argv ctrl-k kill-line
|
||||
bind --preset $argv ctrl-w backward-kill-path-component
|
||||
|
|
|
@ -64,7 +64,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
|||
|
||||
# Default (command) mode
|
||||
bind -s --preset :,q exit
|
||||
bind -s --preset -m insert ctrl-c cancel-commandline repaint-mode
|
||||
bind -s --preset -m insert ctrl-c clear-commandline repaint-mode
|
||||
bind -s --preset -M default h backward-char
|
||||
bind -s --preset -M default l forward-char
|
||||
bind -s --preset -m insert enter execute
|
||||
|
|
|
@ -146,8 +146,8 @@ const INPUT_FUNCTION_METADATA: &[InputFunctionMetadata] = &[
|
|||
make_md(L!("beginning-of-line"), ReadlineCmd::BeginningOfLine),
|
||||
make_md(L!("cancel"), ReadlineCmd::Cancel),
|
||||
make_md(L!("cancel-commandline"), ReadlineCmd::CancelCommandline),
|
||||
make_md(L!("cancel-commandline-traditional"), ReadlineCmd::CancelCommandlineTraditional),
|
||||
make_md(L!("capitalize-word"), ReadlineCmd::CapitalizeWord),
|
||||
make_md(L!("clear-commandline"), ReadlineCmd::ClearCommandline),
|
||||
make_md(L!("clear-screen"), ReadlineCmd::ClearScreenAndRepaint),
|
||||
make_md(L!("complete"), ReadlineCmd::Complete),
|
||||
make_md(L!("complete-and-search"), ReadlineCmd::CompleteAndSearch),
|
||||
|
|
|
@ -122,8 +122,8 @@ pub enum ReadlineCmd {
|
|||
ExpandAbbr,
|
||||
DeleteOrExit,
|
||||
Exit,
|
||||
ClearCommandline,
|
||||
CancelCommandline,
|
||||
CancelCommandlineTraditional,
|
||||
Cancel,
|
||||
Undo,
|
||||
Redo,
|
||||
|
|
|
@ -2309,7 +2309,7 @@ impl<'a> Reader<'a> {
|
|||
self.data
|
||||
.update_buff_pos(EditableLineTag::Commandline, Some(self.command_line_len()));
|
||||
}
|
||||
rl::CancelCommandline | rl::CancelCommandlineTraditional => {
|
||||
rl::CancelCommandline | rl::ClearCommandline => {
|
||||
if self.conf.exit_on_interrupt {
|
||||
self.parser
|
||||
.set_last_statuses(Statuses::just(STATUS_CMD_ERROR.unwrap()));
|
||||
|
@ -2319,10 +2319,11 @@ impl<'a> Reader<'a> {
|
|||
if self.command_line.is_empty() {
|
||||
return;
|
||||
}
|
||||
if c == rl::CancelCommandlineTraditional {
|
||||
if c == rl::CancelCommandline {
|
||||
// Move cursor to the end of the line.
|
||||
let end = self.command_line.len();
|
||||
self.update_buff_pos(EditableLineTag::Commandline, Some(end));
|
||||
|
||||
self.autosuggestion.clear();
|
||||
// Repaint also changes the actual cursor position
|
||||
if self.is_repaint_needed(None) {
|
||||
|
@ -2346,7 +2347,7 @@ impl<'a> Reader<'a> {
|
|||
EditableLineTag::Commandline,
|
||||
Edit::new(0..self.command_line_len(), L!("").to_owned()),
|
||||
);
|
||||
if c == rl::CancelCommandlineTraditional {
|
||||
if c == rl::CancelCommandline {
|
||||
self.screen
|
||||
.reset_abandoning_line(usize::try_from(termsize_last().width).unwrap());
|
||||
}
|
||||
|
@ -5042,7 +5043,7 @@ fn command_ends_paging(c: ReadlineCmd, focused_on_search_field: bool) -> bool {
|
|||
| rl::AcceptAutosuggestion
|
||||
| rl::DeleteOrExit
|
||||
| rl::CancelCommandline
|
||||
| rl::CancelCommandlineTraditional
|
||||
| rl::ClearCommandline
|
||||
| rl::Cancel =>
|
||||
// These commands always end paging.
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user