Stop donating the terminal for bind functions

Unfortunately this causes input coming in while bind functions are
running to show up on screen.

Since the cure is worse than the disease let's just stop doing it.

My guess is this needs to *only* be done while running an external
command.

Fixes #7770
Reintroduces #2114

Partially reverts 5f16a299a7
This commit is contained in:
Fabian Homborg 2021-03-10 20:58:16 +01:00
parent 600c0d5b3f
commit fd9355966e
2 changed files with 15 additions and 7 deletions

View file

@ -2828,13 +2828,19 @@ struct readline_loop_state_t {
/// Run a sequence of commands from an input binding.
void reader_data_t::run_input_command_scripts(const wcstring_list_t &cmds) {
// Need to donate/steal the tty - see #2114.
term_donate();
// Unfortunately this causes us to enable ECHO,
// which means if input arrives while we're running a bind function
// it will turn up on screen, see #7770.
//
// What needs to happen is to tell the parser to acquire the terminal
// when it's running an external command, but that's a lot more involved.
// term_donate();
auto last_statuses = parser().get_last_statuses();
for (const wcstring &cmd : cmds) {
parser().eval(cmd, io_chain_t{});
}
parser().set_last_statuses(std::move(last_statuses));
term_steal();
// term_steal();
}
/// Read normal characters, inserting them into the command line.

View file

@ -92,11 +92,13 @@ send("\x12") # ctrl-r, placing fth in foreground
expect_str("SIGCONT")
# Do it again.
send("\x1A")
expect_str("SIGTSTP")
sleep(0.1)
send("\x12")
expect_str("SIGCONT")
# FIXME: Unfortunately the fix for #2114 had to be reverted because of #7770,
# so this is broken.
# send("\x1A")
# expect_str("SIGTSTP")
# sleep(0.1)
# send("\x12")
# expect_str("SIGCONT")
# End fth by sending it anything.
send("\x12")