fish-shell/share
Johannes Altmanninger 789a280ee8 Fix {Alt,Shift}-Return bindings not expanding abbreviations
Today,

    bind foo "commandline -f expand-abbr; commandline -i \n"

does not work because this
1. enqueues an expand-abbr readline event
2. "commandline -i" inserts \n
3. processes the expand-abbr readline event

Since there is no abbreviation on the new line, this doesn't do anything.

PR https://github.com/fish-shell/fish-shell/pull/9398 would fix this
particular instance however it does not fix the issue that "commandline -i"
is run before the expand-abbr is processed by the reader. This is harmless
here but there would be a problem if "commandline" tried to read commandline
state that was created by a preceding command.

It's not super clear to me whether the above binding should work as one
would naively expect. That would imply that "commandline" would need to
drain all input events (at least all synthetic ones) from the input queue,
to ensure it sees the current state.

Fortunately the parent commit makes it so if we separate them

    bind foo "commandline -f expand-abbr" "commandline -i \n"

both will be separate events and the commandline state will be synced after
each of them. This fixes abbreviation expansion here.

Also, we can now mix readline cmds and shell commands, which makes it shorter.
2024-03-23 10:06:11 +01:00
..
completions rustc: Protect against lines starting with - 2024-03-19 16:49:46 +01:00
functions Fix {Alt,Shift}-Return bindings not expanding abbreviations 2024-03-23 10:06:11 +01:00
groff
tools Reformat share/**.fish with newlines collapsed 2024-02-27 16:25:01 +01:00
__fish_build_paths.fish.in
config.fish Reformat share/**.fish with newlines collapsed 2024-02-27 16:25:01 +01:00