mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-04 09:08:46 +00:00
Use self-insert-notfirst on spaces during paste
This changes a5a643f854
to use the new self-insert-notfirst binding.
It also adds a test.
This commit is contained in:
parent
ea2d6a2a91
commit
4522f5cacb
3 changed files with 14 additions and 1 deletions
|
@ -161,7 +161,7 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
|||
bind --preset -M paste \\ "__fish_commandline_insert_escaped \\\ \$__fish_paste_quoted"
|
||||
# Only insert spaces if we're either quoted or not at the beginning of the commandline
|
||||
# - this strips leading spaces if they would trigger histignore.
|
||||
bind --preset -M paste \ 'if set -q __fish_paste_quoted[1]; or string length -q -- (commandline -c); commandline -i " "; end'
|
||||
bind --preset -M paste " " self-insert-notfirst
|
||||
end
|
||||
|
||||
function __fish_commandline_insert_escaped --description 'Insert the first arg escaped if a second arg is given'
|
||||
|
|
|
@ -299,3 +299,15 @@ expect_prompt -re {nul seen\r\nnul seen\r\nnul seen} {
|
|||
} unmatched {
|
||||
puts stderr "nul not seen"
|
||||
}
|
||||
|
||||
# Test self-insert-notfirst. (#6603)
|
||||
# Here the leading 'q's should be stripped, but the trailing ones not.
|
||||
send "bind q self-insert-notfirst\r"
|
||||
expect_prompt
|
||||
send "qqqecho qqq"
|
||||
send "\r"
|
||||
expect_prompt -re {qqq} {
|
||||
puts "Leading q properly stripped"
|
||||
} unmatched {
|
||||
puts stderr "Leading qs not stripped"
|
||||
}
|
||||
|
|
|
@ -23,3 +23,4 @@ ctrl-o seen
|
|||
ctrl-w stops at :
|
||||
ctrl-w stops at @
|
||||
nul seen
|
||||
Leading q properly stripped
|
||||
|
|
Loading…
Reference in a new issue