From 49528da8a60f8fd38ca491d6ccec47dfccf5f23c Mon Sep 17 00:00:00 2001 From: Anton Sharonov Date: Sun, 14 Apr 2024 20:02:24 +0200 Subject: patch 9.1.0321: Garbled output on serial terminals with XON/XOFF flow control Problem: When used terminal with XON/XOFF flow control, vim tries to still make CTRL-S mapping available, which results in severe screen corruption, especially on large redraws, and even spurious inputs (John Tsiombikas) Solution: Disallow CTRL-S mapping if such terminal is recognized. Don't remove IXON from the bitmask inversion. (Anton Sharonov) *** When started like this: TERM=vt420 vim :set termcap shows "t_xon=y" map :echo "abc" does nothing (after output freezes and subsequent unfreezes it) *** When started like this: TERM=xterm vim :set termcap shows "t_xon=" map :echo "abc" works (after one see "abc" string echo-ed) fixes: #12674 closes: #14542 Signed-off-by: Anton Sharonov Signed-off-by: Christian Brabandt --- src/os_unix.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/os_unix.c') diff --git a/src/os_unix.c b/src/os_unix.c index da7f56a675..d15514268f 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3766,7 +3766,8 @@ mch_settmode(tmode_T tmode) { // ~ICRNL enables typing ^V^M // ~IXON disables CTRL-S stopping output, so that it can be mapped. - tnew.c_iflag &= ~(ICRNL | IXON); + tnew.c_iflag &= ~(ICRNL | + (T_XON == NULL || *T_XON == NUL ? IXON : 0)); tnew.c_lflag &= ~(ICANON | ECHO | ISIG | ECHOE # if defined(IEXTEN) | IEXTEN // IEXTEN enables typing ^V on SOLARIS -- cgit v1.2.3