"commandline -f foo" to skip queue and execute immediately

Commit c3cd68dda (Process shell commands from bindings like regular char
events, 2024-03-02) mentions a "weird ordering difference".
The issue is that "commandline -f foo" goes through the input
queue while other commands are executed directly.
For example

    bind ctrl-g "commandline -f end-of-line; commandline -i x"

is executed in the wrong order. Fix that.

This doesn't yet work for "commandline -f exit" but that can be fixed easily.

It's hard to imagine anyone would rely on the existing behavior.  "commandline
-f" in bindings is mostly used for repainting the commandline.
This commit is contained in:
Johannes Altmanninger
2024-04-08 23:24:24 +02:00
parent 9d7116c12d
commit a583fe7230
4 changed files with 34 additions and 10 deletions

View File

@@ -358,6 +358,20 @@ send('\x02\x02\x02') # ctrl-b, backward-char
sendline('\x1bu') # alt+u, upcase word
expect_prompt("fooBAR")
send("""
bind ctrl-g "
commandline --insert 'echo foo ar'
commandline -f backward-word
commandline --insert b
commandline -f backward-char
commandline -f backward-char
commandline -f delete-char
"
""")
send('\x07') # ctrl-g
send('\r')
expect_prompt("foobar")
# Check that the builtin version of `exit` works
# (for obvious reasons this MUST BE LAST)
sendline("function myexit; echo exit; exit; end; bind ctrl-z myexit")