Fix assertion error in when scrollback-push is enqueued from script
Some checks are pending
make test / ubuntu (push) Waiting to run
make test / ubuntu-32bit-static-pcre2 (push) Waiting to run
make test / ubuntu-asan (push) Waiting to run
make test / macos (push) Waiting to run
Rust checks / rustfmt (push) Waiting to run
Rust checks / clippy (push) Waiting to run

As soon as we start processing a scrollback-push readline command, we
pause execution of all other readline commands until scrollback-push
retires.  This means that we never get into a situation with two
active scrollback-push commands -- unless we are executing readline
commands via a script running "commandline -f":
since the first part of scrollback-push handling returns immediately,
the script will proceed before scrollback-push retires.

A second scrollback-push fails an assertion.  Work around that for now.
In future, scrollback-push should block when invoked by such a script,
just like it does when invoked from bindings.
This commit is contained in:
Johannes Altmanninger 2024-12-30 13:59:03 +01:00
parent 8910390602
commit 13763fa318
2 changed files with 12 additions and 0 deletions

View File

@ -3508,6 +3508,10 @@ impl<'a> Reader<'a> {
self.parser.libdata_mut().is_repaint = false;
}
rl::ScrollbackPush => {
if self.waiting_for_cursor_position.is_some() {
// TODO: re-queue it I guess.
return;
}
self.request_cursor_position(WaitingForCursorPosition::ScrollbackPush);
}
rl::SelfInsert | rl::SelfInsertNotFirst | rl::FuncAnd | rl::FuncOr => {

View File

@ -0,0 +1,8 @@
#RUN: %fish %s
#REQUIRES: command -v tmux
isolated-tmux-start
isolated-tmux send-keys 'bind ctrl-g "commandline -f scrollback-push scrollback-push"' Enter C-g
tmux-sleep
isolated-tmux capture-pane -p
# CHECK: prompt 1>