]> Sergey Matveev's repositories - st.git/commitdiff
ignore C1 control characters in UTF-8 mode
authorHiltjo Posthuma <hiltjo@codemadness.org>
Tue, 7 Feb 2023 19:00:59 +0000 (20:00 +0100)
committerHiltjo Posthuma <hiltjo@codemadness.org>
Tue, 7 Feb 2023 19:00:59 +0000 (20:00 +0100)
Ignore processing and printing C1 control characters in UTF-8 mode.
These are in the range: 0x80 - 0x9f.

By default in st the mode is set to UTF-8.

This matches more the behaviour of xterm with the options -u8 or +u8 also.
Also see the xterm resource "allowC1Printable".

Let me know if this breaks something, in most cases I don't think so.

As usual a very good reference is:
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html

st.c

diff --git a/st.c b/st.c
index 49357cc9d11b1ad6bd8a954ee626f3a5d309877b..134e7242e9b18d33dd82df401cbd266d9b9f30fd 100644 (file)
--- a/st.c
+++ b/st.c
@@ -2422,6 +2422,9 @@ check_control_code:
         * they must not cause conflicts with sequences.
         */
        if (control) {
+               /* in UTF-8 mode ignore handling C1 control characters */
+               if (IS_SET(MODE_UTF8) && ISCONTROLC1(u))
+                       return;
                tcontrolcode(u);
                /*
                 * control codes are not shown ever