Work around to prevent premature Ctrl-D from inserting spaces

Pressing Ctrl-D while a command is running results in a null key code in
our input queue. That key code is bound to insert a space (without expanding
abbreviations). Make it only insert a space if the commandline is non-empty,
to accommodate this use case.

This probably affects other keys as well.

Closes #8871
This commit is contained in:
Johannes Altmanninger
2022-05-11 21:57:37 +02:00
parent 32aef855b7
commit a8b3922a74
2 changed files with 2 additions and 1 deletions

View File

@@ -186,7 +186,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
# Closing a command substitution expands abbreviations
bind --preset $argv ")" self-insert expand-abbr
# Ctrl-space inserts space without expanding abbrs
bind --preset $argv -k nul 'commandline -i " "'
bind --preset $argv -k nul 'test -n "$(commandline)" && commandline -i " "'
# Shift-space (CSI u escape sequence) behaves like space because it's easy to mistype.
bind --preset $argv \e\[32\;2u 'commandline -i " "; commandline -f expand-abbr'.