The actual terminfo entries we ended up with for cursor changes are Cs,

Ce, Ss and Se (not Cc, Ce, Cs, Csr). So use and document these instead
of the ones we were using earlier.
This commit is contained in:
Nicholas Marriott 2013-06-02 07:52:15 +00:00
parent c231381aa3
commit 13441e8cb8
5 changed files with 19 additions and 19 deletions

View File

@ -416,8 +416,8 @@ const struct options_table_entry session_options_table[] = {
.type = OPTIONS_TABLE_STRING, .type = OPTIONS_TABLE_STRING,
.default_str = "*256col*:colors=256" .default_str = "*256col*:colors=256"
",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007" ",xterm*:XT:Ms=\\E]52;%p1%s;%p2%s\\007"
":Cc=\\E]12;%p1%s\\007:Cr=\\E]112\\007" ":Cs=\\E]12;%p1%s\\007:Cr=\\E]112\\007"
":Cs=\\E[%p1%d q:Csr=\\E[2 q,screen*:XT" ":Ss=\\E[%p1%d q:Se=\\E[2 q,screen*:XT"
}, },
{ .name = "update-environment", { .name = "update-environment",

4
tmux.1
View File

@ -3571,7 +3571,7 @@ This command only works from outside
understands some extensions to understands some extensions to
.Xr terminfo 5 : .Xr terminfo 5 :
.Bl -tag -width Ds .Bl -tag -width Ds
.It Em Cc , Cr .It Em Cs , Cr
Set the cursor colour. Set the cursor colour.
The first takes a single string argument and is used to set the colour; The first takes a single string argument and is used to set the colour;
the second takes no arguments and restores the default cursor colour. the second takes no arguments and restores the default cursor colour.
@ -3581,7 +3581,7 @@ to change the cursor colour from inside
.Bd -literal -offset indent .Bd -literal -offset indent
$ printf '\e033]12;red\e033\e\e' $ printf '\e033]12;red\e033\e\e'
.Ed .Ed
.It Em Cs , Csr .It Em Ss , Se
Change the cursor style. Change the cursor style.
If set, a sequence such as this may be used If set, a sequence such as this may be used
to change the cursor to an underline: to change the cursor to an underline:

6
tmux.h
View File

@ -253,15 +253,13 @@ enum tty_code_code {
TTYC_BEL, /* bell, bl */ TTYC_BEL, /* bell, bl */
TTYC_BLINK, /* enter_blink_mode, mb */ TTYC_BLINK, /* enter_blink_mode, mb */
TTYC_BOLD, /* enter_bold_mode, md */ TTYC_BOLD, /* enter_bold_mode, md */
TTYC_CC, /* set colour cursor, Cc */
TTYC_CIVIS, /* cursor_invisible, vi */ TTYC_CIVIS, /* cursor_invisible, vi */
TTYC_CLEAR, /* clear_screen, cl */ TTYC_CLEAR, /* clear_screen, cl */
TTYC_CNORM, /* cursor_normal, ve */ TTYC_CNORM, /* cursor_normal, ve */
TTYC_COLORS, /* max_colors, Co */ TTYC_COLORS, /* max_colors, Co */
TTYC_CR, /* restore cursor colour, Cr */ TTYC_CR, /* restore cursor colour, Cr */
TTYC_CS1, /* set cursor style, Cs */ TTYC_CS, /* set cursor colour, Cs */
TTYC_CSR, /* change_scroll_region, cs */ TTYC_CSR, /* change_scroll_region, cs */
TTYC_CSR1, /* reset cursor style, Csr */
TTYC_CUB, /* parm_left_cursor, LE */ TTYC_CUB, /* parm_left_cursor, LE */
TTYC_CUB1, /* cursor_left, le */ TTYC_CUB1, /* cursor_left, le */
TTYC_CUD, /* parm_down_cursor, DO */ TTYC_CUD, /* parm_down_cursor, DO */
@ -391,6 +389,7 @@ enum tty_code_code {
TTYC_RMACS, /* exit_alt_charset_mode */ TTYC_RMACS, /* exit_alt_charset_mode */
TTYC_RMCUP, /* exit_ca_mode, te */ TTYC_RMCUP, /* exit_ca_mode, te */
TTYC_RMKX, /* keypad_local, ke */ TTYC_RMKX, /* keypad_local, ke */
TTYC_SE, /* reset cursor style, Se */
TTYC_SETAB, /* set_a_background, AB */ TTYC_SETAB, /* set_a_background, AB */
TTYC_SETAF, /* set_a_foreground, AF */ TTYC_SETAF, /* set_a_foreground, AF */
TTYC_SGR0, /* exit_attribute_mode, me */ TTYC_SGR0, /* exit_attribute_mode, me */
@ -400,6 +399,7 @@ enum tty_code_code {
TTYC_SMKX, /* keypad_xmit, ks */ TTYC_SMKX, /* keypad_xmit, ks */
TTYC_SMSO, /* enter_standout_mode, so */ TTYC_SMSO, /* enter_standout_mode, so */
TTYC_SMUL, /* enter_underline_mode, us */ TTYC_SMUL, /* enter_underline_mode, us */
TTYC_SS, /* set cursor style, Ss */
TTYC_TSL, /* to_status_line, tsl */ TTYC_TSL, /* to_status_line, tsl */
TTYC_VPA, /* row_address, cv */ TTYC_VPA, /* row_address, cv */
TTYC_XENL, /* eat_newline_glitch, xn */ TTYC_XENL, /* eat_newline_glitch, xn */

View File

@ -38,15 +38,13 @@ const struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
{ TTYC_BEL, TTYCODE_STRING, "bel" }, { TTYC_BEL, TTYCODE_STRING, "bel" },
{ TTYC_BLINK, TTYCODE_STRING, "blink" }, { TTYC_BLINK, TTYCODE_STRING, "blink" },
{ TTYC_BOLD, TTYCODE_STRING, "bold" }, { TTYC_BOLD, TTYCODE_STRING, "bold" },
{ TTYC_CC, TTYCODE_STRING, "Cc" },
{ TTYC_CIVIS, TTYCODE_STRING, "civis" }, { TTYC_CIVIS, TTYCODE_STRING, "civis" },
{ TTYC_CLEAR, TTYCODE_STRING, "clear" }, { TTYC_CLEAR, TTYCODE_STRING, "clear" },
{ TTYC_CNORM, TTYCODE_STRING, "cnorm" }, { TTYC_CNORM, TTYCODE_STRING, "cnorm" },
{ TTYC_COLORS, TTYCODE_NUMBER, "colors" }, { TTYC_COLORS, TTYCODE_NUMBER, "colors" },
{ TTYC_CR, TTYCODE_STRING, "Cr" }, { TTYC_CR, TTYCODE_STRING, "Cr" },
{ TTYC_CS1, TTYCODE_STRING, "Cs" }, { TTYC_CS, TTYCODE_STRING, "Cs" },
{ TTYC_CSR, TTYCODE_STRING, "csr" }, { TTYC_CSR, TTYCODE_STRING, "csr" },
{ TTYC_CSR1, TTYCODE_STRING, "Csr" },
{ TTYC_CUB, TTYCODE_STRING, "cub" }, { TTYC_CUB, TTYCODE_STRING, "cub" },
{ TTYC_CUB1, TTYCODE_STRING, "cub1" }, { TTYC_CUB1, TTYCODE_STRING, "cub1" },
{ TTYC_CUD, TTYCODE_STRING, "cud" }, { TTYC_CUD, TTYCODE_STRING, "cud" },
@ -176,6 +174,7 @@ const struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
{ TTYC_RMACS, TTYCODE_STRING, "rmacs" }, { TTYC_RMACS, TTYCODE_STRING, "rmacs" },
{ TTYC_RMCUP, TTYCODE_STRING, "rmcup" }, { TTYC_RMCUP, TTYCODE_STRING, "rmcup" },
{ TTYC_RMKX, TTYCODE_STRING, "rmkx" }, { TTYC_RMKX, TTYCODE_STRING, "rmkx" },
{ TTYC_SE, TTYCODE_STRING, "Se" },
{ TTYC_SETAB, TTYCODE_STRING, "setab" }, { TTYC_SETAB, TTYCODE_STRING, "setab" },
{ TTYC_SETAF, TTYCODE_STRING, "setaf" }, { TTYC_SETAF, TTYCODE_STRING, "setaf" },
{ TTYC_SGR0, TTYCODE_STRING, "sgr0" }, { TTYC_SGR0, TTYCODE_STRING, "sgr0" },
@ -185,6 +184,7 @@ const struct tty_term_code_entry tty_term_codes[NTTYCODE] = {
{ TTYC_SMKX, TTYCODE_STRING, "smkx" }, { TTYC_SMKX, TTYCODE_STRING, "smkx" },
{ TTYC_SMSO, TTYCODE_STRING, "smso" }, { TTYC_SMSO, TTYCODE_STRING, "smso" },
{ TTYC_SMUL, TTYCODE_STRING, "smul" }, { TTYC_SMUL, TTYCODE_STRING, "smul" },
{ TTYC_SS, TTYCODE_STRING, "Ss" },
{ TTYC_TSL, TTYCODE_STRING, "tsl" }, { TTYC_TSL, TTYCODE_STRING, "tsl" },
{ TTYC_VPA, TTYCODE_STRING, "vpa" }, { TTYC_VPA, TTYCODE_STRING, "vpa" },
{ TTYC_XENL, TTYCODE_FLAG, "xenl" }, { TTYC_XENL, TTYCODE_FLAG, "xenl" },

18
tty.c
View File

@ -270,11 +270,11 @@ tty_stop_tty(struct tty *tty)
tty_raw(tty, tty_term_string(tty->term, TTYC_SGR0)); tty_raw(tty, tty_term_string(tty->term, TTYC_SGR0));
tty_raw(tty, tty_term_string(tty->term, TTYC_RMKX)); tty_raw(tty, tty_term_string(tty->term, TTYC_RMKX));
tty_raw(tty, tty_term_string(tty->term, TTYC_CLEAR)); tty_raw(tty, tty_term_string(tty->term, TTYC_CLEAR));
if (tty_term_has(tty->term, TTYC_CS1) && tty->cstyle != 0) { if (tty_term_has(tty->term, TTYC_SS) && tty->cstyle != 0) {
if (tty_term_has(tty->term, TTYC_CSR1)) if (tty_term_has(tty->term, TTYC_SE))
tty_raw(tty, tty_term_string(tty->term, TTYC_CSR1)); tty_raw(tty, tty_term_string(tty->term, TTYC_SE));
else else
tty_raw(tty, tty_term_string1(tty->term, TTYC_CS1, 0)); tty_raw(tty, tty_term_string1(tty->term, TTYC_SS, 0));
} }
tty_raw(tty, tty_term_string(tty->term, TTYC_CR)); tty_raw(tty, tty_term_string(tty->term, TTYC_CR));
@ -455,7 +455,7 @@ tty_force_cursor_colour(struct tty *tty, const char *ccolour)
if (*ccolour == '\0') if (*ccolour == '\0')
tty_putcode(tty, TTYC_CR); tty_putcode(tty, TTYC_CR);
else else
tty_putcode_ptr1(tty, TTYC_CC, ccolour); tty_putcode_ptr1(tty, TTYC_CS, ccolour);
free(tty->ccolour); free(tty->ccolour);
tty->ccolour = xstrdup(ccolour); tty->ccolour = xstrdup(ccolour);
} }
@ -479,12 +479,12 @@ tty_update_mode(struct tty *tty, int mode, struct screen *s)
tty_putcode(tty, TTYC_CIVIS); tty_putcode(tty, TTYC_CIVIS);
} }
if (tty->cstyle != s->cstyle) { if (tty->cstyle != s->cstyle) {
if (tty_term_has(tty->term, TTYC_CS1)) { if (tty_term_has(tty->term, TTYC_SS)) {
if (s->cstyle == 0 && if (s->cstyle == 0 &&
tty_term_has(tty->term, TTYC_CSR1)) tty_term_has(tty->term, TTYC_SE))
tty_putcode(tty, TTYC_CSR1); tty_putcode(tty, TTYC_SE);
else else
tty_putcode1(tty, TTYC_CS1, s->cstyle); tty_putcode1(tty, TTYC_SS, s->cstyle);
} }
tty->cstyle = s->cstyle; tty->cstyle = s->cstyle;
} }