mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-02 22:21:15 -03:00
Fix "bind -M somemode" crash for empty bind modes
This loop iterates over all bindings and crashes if a mode filter
argument is given for a mode that has no binding. Fix this by
continuing the loop earlier.
Fixes 11d6e92cb5 (Show file location when querying bindings with bind, 2025-12-28)
Fixes #12798
This commit is contained in:
@@ -213,6 +213,9 @@ fn list(
|
||||
let mut cur_file = None;
|
||||
|
||||
for binding in lst {
|
||||
if bind_mode.is_some_and(|m| m != binding.mode) {
|
||||
continue;
|
||||
}
|
||||
let mut out = WString::new();
|
||||
let definition_file =
|
||||
&self.input_mappings.get(&binding.seq, bind_mode, user)[0].definition_file;
|
||||
@@ -233,9 +236,6 @@ fn list(
|
||||
cur_file = Some(def_file);
|
||||
}
|
||||
}
|
||||
if bind_mode.is_some_and(|m| m != binding.mode) {
|
||||
continue;
|
||||
}
|
||||
self.list_one(&binding.seq, Some(&binding.mode), user, parser, streams);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
set -l fish (status fish-path)
|
||||
|
||||
bind -M insert
|
||||
|
||||
set -l tmpdir (mktemp -d)
|
||||
for bindings in true fish_default_key_bindings fish_vi_key_bindings
|
||||
$fish -c "
|
||||
|
||||
Reference in New Issue
Block a user