mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:30:28 +08:00
00432df420
On a; we don't expand the abbreviation because the cursor is right of semicolon, not on the command token. Fix this by making sure that we call expand-abbr with the cursor on the semicolon which is the end of the command token. (Now that our bind command execution order is less surprising, this is doable.) This means that we need to fix the cursor after successfully expanding an abbreviation. Do this by setting the position explicitly even when no --set-position is in effect. An earlier version of this patch used bind space self-insert backward-char expand-abbr or forward-char The problem with that (as a failing test shows) was that given "abbr m myabbr", after typing "m space ctrl-z", the cursor would be after the "m", not after the space. The second space removes the space, not changing the cursor position, which is weird. I initially tried to fix this by adding a hack to the undo group logic, to always restore the cursor position from when begin-undo-group was used. bind space self-insert begin-undo-group backward-char expand-abbr end-undo-group or forward-char However this made test_torn_escapes.py fail for mysterious reasons. I believe this is because that test registers and triggers a SIGUSR1 handler; since the signal handler will rearrange char events, that probably messes with the undo group guards. I resorted to adding a tailor-made readline cmd. We could probably remove it and give the new behavior to expand-abbr, not sure. Fixes #9730 |
||
---|---|---|
.. | ||
completions | ||
functions | ||
groff | ||
tools | ||
__fish_build_paths.fish.in | ||
config.fish |