diff options
author | Thomas Adam <thomas@xteddy.org> | 2020-01-28 12:01:28 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2020-01-28 12:01:28 +0000 |
commit | 60ab7144517483d4343e7a68625e376c34557b8a (patch) | |
tree | a0ed2af485858723be0afbfba456f446aafbbd7a /tty-term.c | |
parent | 685eb381dec7fc741a15ce11a84d8c96ed66ce42 (diff) | |
parent | a6129e99749d2bbc8b4a991c7b5d09300aa55f39 (diff) | |
download | rtmux-60ab7144517483d4343e7a68625e376c34557b8a.tar.gz rtmux-60ab7144517483d4343e7a68625e376c34557b8a.tar.bz2 rtmux-60ab7144517483d4343e7a68625e376c34557b8a.zip |
Merge branch 'obsd-master'
Diffstat (limited to 'tty-term.c')
-rw-r--r-- | tty-term.c | 28 |
1 files changed, 9 insertions, 19 deletions
@@ -528,11 +528,16 @@ tty_term_find(char *name, int fd, char **cause) goto error; } - /* Figure out if we have 256 colours (or more). */ - if (tty_term_number(term, TTYC_COLORS) >= 256 || - tty_term_has(term, TTYC_RGB)) + /* Set flag if terminal has 256 colours. */ + if (tty_term_number(term, TTYC_COLORS) >= 256) term->flags |= TERM_256COLOURS; + /* Set flag if terminal has RGB colours. */ + if ((tty_term_flag(term, TTYC_TC) || tty_term_has(term, TTYC_RGB)) || + (tty_term_has(term, TTYC_SETRGBF) && + tty_term_has(term, TTYC_SETRGBB))) + term->flags |= TERM_RGBCOLOURS; + /* * Terminals without xenl (eat newline glitch) wrap at at $COLUMNS - 1 * rather than $COLUMNS (the cursor can never be beyond $COLUMNS - 1). @@ -567,22 +572,7 @@ tty_term_find(char *name, int fd, char **cause) code->type = TTYCODE_STRING; } - /* - * On terminals with RGB colour (Tc or RGB), fill in setrgbf and - * setrgbb if they are missing. - */ - if ((tty_term_flag(term, TTYC_TC) || tty_term_flag(term, TTYC_RGB)) && - !tty_term_has(term, TTYC_SETRGBF) && - !tty_term_has(term, TTYC_SETRGBB)) { - code = &term->codes[TTYC_SETRGBF]; - code->value.string = xstrdup("\033[38;2;%p1%d;%p2%d;%p3%dm"); - code->type = TTYCODE_STRING; - code = &term->codes[TTYC_SETRGBB]; - code->value.string = xstrdup("\033[48;2;%p1%d;%p2%d;%p3%dm"); - code->type = TTYCODE_STRING; - } - - /* Log it. */ + /* Log the capabilities. */ for (i = 0; i < tty_term_ncodes(); i++) log_debug("%s%s", name, tty_term_describe(term, i)); |