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 <C-S> :echo "abc"<CR>

    does nothing (after <C-S> output freezes and subsequent <C-Q>
    unfreezes it)

*** When started like this:

    TERM=xterm vim

:set termcap

    shows "t_xon="

map <C-S> :echo "abc"<CR>

    works (after <C-S> one see "abc" string echo-ed)

fixes: #12674
closes: #14542

Signed-off-by: Anton Sharonov <anton.sharonov@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 229a4ef..48f582b 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -1157,6 +1157,7 @@
 't_vi'	term.txt	/*'t_vi'*
 't_vs'	term.txt	/*'t_vs'*
 't_xn'	term.txt	/*'t_xn'*
+'t_xo'	term.txt	/*'t_xo'*
 't_xs'	term.txt	/*'t_xs'*
 'ta'	options.txt	/*'ta'*
 'tabline'	options.txt	/*'tabline'*
@@ -10403,6 +10404,7 @@
 t_vi	term.txt	/*t_vi*
 t_vs	term.txt	/*t_vs*
 t_xn	term.txt	/*t_xn*
+t_xo	term.txt	/*t_xo*
 t_xs	term.txt	/*t_xs*
 tab	intro.txt	/*tab*
 tab-page	tabpage.txt	/*tab-page*
diff --git a/runtime/doc/term.txt b/runtime/doc/term.txt
index d958229..1256d75 100644
--- a/runtime/doc/term.txt
+++ b/runtime/doc/term.txt
@@ -1,4 +1,4 @@
-*term.txt*      For Vim version 9.1.  Last change: 2024 Feb 28
+*term.txt*      For Vim version 9.1.  Last change: 2024 Apr 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -382,7 +382,7 @@
 the last two characters of the option name.  Only one termcap code is
 required: Cursor motion, 't_cm'.
 
-The options 't_da', 't_db', 't_ms', 't_xs', 't_xn' represent flags in the
+The options 't_da', 't_db', 't_ms', 't_xs', 't_xn', 't_xo' represent flags in the
 termcap.  When the termcap flag is present, the option will be set to "y".
 But any non-empty string means that the flag is set.  An empty string means
 that the flag is not set.  't_CS' works like this too, but it isn't a termcap
@@ -441,6 +441,11 @@
 								*t_xn* *'t_xn'*
 	t_xn	if non-empty, writing a character at the last screen cell
 		does not cause scrolling
+								*t_xo* *'t_xo'*
+	t_xo	if non-empty, terminal uses xon/xoff handshaking, mapping
+		CTRL-S will not be possible then, since it is used for flow
+		control (used by vt420 terminal).  Setting this flag has only
+		an effect when starting Vim.
 	t_ZH	italics mode					*t_ZH* *'t_ZH'*
 	t_ZR	italics end					*t_ZR* *'t_ZR'*
 
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 30fd791..69604e9 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt*  For Vim version 9.1.  Last change: 2024 Apr 08
+*version9.txt*  For Vim version 9.1.  Last change: 2024 Apr 14
 
 
 		  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -41591,6 +41591,7 @@
 Options: ~
 
 'winfixbuf'		Keep buffer focused in a window
+'t_xo'			Terminal uses XON/XOFF handshaking (e.g. vt420).
 
 ==============================================================================
 INCOMPATIBLE CHANGES				*incompatible-9.2*