fish-shell/tests/pexpects
Johannes Altmanninger 00432df420 Trigger abbreviations after inserting process separators
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
2024-04-13 20:11:11 +02:00
..
abbrs.py Trigger abbreviations after inserting process separators 2024-04-13 20:11:11 +02:00
bind_mode_events.py Disable failing bind_mode_events.py in FreeBSD for now 2024-04-12 12:34:01 +02:00
bind.py Try to fix macOS CI by disabling fg.py, signals.py, torn_escapes.py 2024-04-12 11:27:55 +02:00
cancel_event.py Control-C to simply clear commandline buffer again 2024-01-17 19:54:57 +01:00
commandline.py Insert some completions with quotes instead of backslashes 2024-04-13 15:34:21 +02:00
complete-group-order.py Restyle fishscript and python 2023-06-01 18:20:19 +02:00
complete.py Disable terminal protocols throughout evaluation 2024-04-02 21:25:47 +02:00
cursor_selection.py Restyle fishscript and python 2023-06-01 18:20:19 +02:00
disable_mouse.py Fix mouse handling tests to send valid escape sequences 2024-04-02 14:35:16 +02:00
eval-stack-overflow.py Restyle fishscript and python 2023-06-01 18:20:19 +02:00
exit_handlers.py Add a test that fish_exit handlers run on receipt of SIGHUP 2020-08-30 15:09:34 -07:00
exit_nohang.py tests: Increase a sleep 2023-11-15 17:58:42 +01:00
exit.py Reformat 2020-11-22 14:39:48 +01:00
fg.py Add missing import to fg.py 2024-04-12 11:41:40 +02:00
fkr.py Extended & human-friendly keys 2024-04-02 14:35:16 +02:00
generic.py pexpects: Fix spurious failure in generic.py 2023-08-15 19:14:33 +02:00
histfile.py tests/histfile.py: Check for no jobs 2024-04-02 22:24:09 +02:00
history.py tests/pexpect: Fix \d escape 2024-04-02 22:41:54 +02:00
isatty.py Reformat 2020-11-22 14:39:48 +01:00
job_summary.py tests/pexpect: Fix \d escape 2024-04-02 22:41:54 +02:00
nullterm.py Be careful to not touch curses variables if cur_term is null 2022-04-16 13:26:56 -07:00
pipeline.py Improve error for redirections to invalid paths 2021-11-20 17:44:05 +01:00
postexec.py Reformat 2020-11-22 14:39:48 +01:00
private_mode.py Restyle fishscript and python 2023-06-01 18:20:19 +02:00
read.py Enable focus reporting only just before reading from stdin 2024-04-06 11:22:19 +02:00
set_color.py set_color: Print the given colors with --print-colors 2022-07-01 21:28:35 +02:00
sigint.py Add missing expect_prompt to test_sigint.py 2024-01-07 00:54:22 +01:00
signals.py Try to fix macOS CI by disabling fg.py, signals.py, torn_escapes.py 2024-04-12 11:27:55 +02:00
status.py Disable terminal protocols throughout evaluation 2024-04-02 21:25:47 +02:00
stdin_nonblocking.py stdin_nonblocking.py test to not leave background processes 2022-02-12 11:48:55 -08:00
terminal.py Disable terminal protocols throughout evaluation 2024-04-02 21:25:47 +02:00
torn_escapes.py Try to fix macOS CI by disabling fg.py, signals.py, torn_escapes.py 2024-04-12 11:27:55 +02:00
tty_ownership.py Claim the tty unconditionally in reader_data_t::readline 2022-09-09 13:43:29 -07:00
undo.py Fix restoring cursor position on redo with edit groups 2024-04-13 14:36:11 +02:00
wait.py share/config.fish: Quit if job expansion hack errors 2023-06-10 15:36:36 +02:00
wildcard_tab.py Restyle fishscript and python 2023-06-01 18:20:19 +02:00