mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:17:12 +08:00
Test that bind output can recreate the same bindings
This commit is contained in:
parent
8949c44574
commit
e934e1b009
|
@ -204,7 +204,7 @@ function fish_vi_key_bindings --description 'vi-like key bindings for fish'
|
|||
bind -s --preset K 'man (commandline -t) 2>/dev/null; or echo -n \a'
|
||||
|
||||
bind -s --preset yy kill-whole-line yank
|
||||
for seq in '",*,y,y' '",*,Y' '"+,y,y' '",+,Y'
|
||||
for seq in '",*,y,y' '",*,Y' '",+,y,y' '",+,Y'
|
||||
bind -s --preset $seq fish_clipboard_copy
|
||||
end
|
||||
bind -s --preset Y kill-whole-line yank
|
||||
|
|
|
@ -265,7 +265,7 @@ pub(crate) fn parse_keys(value: &wstr) -> Result<Vec<Key>, WString> {
|
|||
_ if modifier == "shift" => modifiers.shift = true,
|
||||
_ => {
|
||||
return Err(wgettext_fmt!(
|
||||
"unknown modififer '%s' in '%s'",
|
||||
"unknown modifier '%s' in '%s'",
|
||||
modifier,
|
||||
full_key_name
|
||||
))
|
||||
|
@ -431,7 +431,7 @@ fn ctrl_to_symbol(buf: &mut WString, c: char) {
|
|||
/// Return true if the character must be escaped when used in the sequence of chars to be bound in
|
||||
/// a `bind` command.
|
||||
fn must_escape(c: char) -> bool {
|
||||
"[]()<>{}*\\?$#;&|'\"".contains(c)
|
||||
"~[]()<>{}*\\?$#;&|'\"".contains(c)
|
||||
}
|
||||
|
||||
fn ascii_printable_to_symbol(buf: &mut WString, c: char) {
|
||||
|
|
|
@ -1,4 +1,23 @@
|
|||
#RUN: %fish %s | %filter-ctrlseqs
|
||||
#REQUIRES: command -v diff
|
||||
|
||||
set -l fish (status fish-path)
|
||||
|
||||
set -l tmpdir (mktemp -d)
|
||||
for bindings in true fish_default_key_bindings fish_vi_key_bindings
|
||||
$fish -c "
|
||||
$bindings
|
||||
bind > $tmpdir/old
|
||||
bind --erase --all --preset
|
||||
bind --erase --all
|
||||
source $tmpdir/old
|
||||
bind >$tmpdir/new
|
||||
diff -u $tmpdir/{old,new}
|
||||
"
|
||||
end
|
||||
echo >&2 bind output evaluation works
|
||||
# CHECKERR: bind output evaluation works
|
||||
|
||||
# Test various `bind` command invocations. This is meant to verify that
|
||||
# invalid flags, mode names, etc. are caught as well as to verify that valid
|
||||
# ones are allowed.
|
||||
|
|
Loading…
Reference in New Issue
Block a user