From c83436d050dbd731acc3d8ce846d84adfc3cc54e Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Thu, 11 Feb 2021 21:17:24 +0100 Subject: [PATCH] Don't overwrite IXON/IXOFF for startup modes We actually restore those before exit, so this would force-disable flow control whenever fish exits. --- src/reader.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/reader.cpp b/src/reader.cpp index c4605a8ce..ea5e806ca 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1319,10 +1319,6 @@ void reader_init() { // Save the initial terminal mode. tcgetattr(STDIN_FILENO, &terminal_mode_on_startup); - // Disable flow control by default. - terminal_mode_on_startup.c_iflag &= ~IXON; - terminal_mode_on_startup.c_iflag &= ~IXOFF; - // Set the mode used for program execution, initialized to the current mode. std::memcpy(&tty_modes_for_external_cmds, &terminal_mode_on_startup, sizeof tty_modes_for_external_cmds); @@ -1331,6 +1327,12 @@ void reader_init() { // Set the mode used for the terminal, initialized to the current mode. std::memcpy(&shell_modes, &terminal_mode_on_startup, sizeof shell_modes); + // Disable flow control by default. + tty_modes_for_external_cmds.c_iflag &= ~IXON; + tty_modes_for_external_cmds.c_iflag &= ~IXOFF; + shell_modes.c_iflag &= ~IXON; + shell_modes.c_iflag &= ~IXOFF; + term_fix_modes(&shell_modes); // We do this not because we actually need the window size but for its side-effect of correctly