# HG changeset patch # User Christian Brabandt # Date 1503234904 -7200 # Node ID 36456f237c591517ad9dadd6223c4d24bf71af40 # Parent 35d5f26cc2919961957457a6d049eb7d52db703f patch 8.0.0973: initial info about blinking cursor is wrong commit https://github.com/vim/vim/commit/ce1c32780a7d0ae5110eab627fcbfd4a11e5eb52 Author: Bram Moolenaar Date: Sun Aug 20 15:05:15 2017 +0200 patch 8.0.0973: initial info about blinking cursor is wrong Problem: initial info about blinking cursor is wrong Solution: Invert the blink flag. Add t_VS to stop a blinking cursor. diff --git a/src/option.c b/src/option.c --- a/src/option.c +++ b/src/option.c @@ -3157,6 +3157,8 @@ static struct vimoption options[] = p_term("t_AL", T_CAL) p_term("t_al", T_AL) p_term("t_bc", T_BC) + p_term("t_BE", T_BE) + p_term("t_BD", T_BD) p_term("t_cd", T_CD) p_term("t_ce", T_CE) p_term("t_cl", T_CL) @@ -3173,13 +3175,11 @@ static struct vimoption options[] = p_term("t_db", T_DB) p_term("t_DL", T_CDL) p_term("t_dl", T_DL) + p_term("t_EC", T_CEC) p_term("t_EI", T_CEI) p_term("t_fs", T_FS) + p_term("t_GP", T_CGP) p_term("t_IE", T_CIE) - p_term("t_SC", T_CSC) - p_term("t_EC", T_CEC) - p_term("t_SH", T_CSH) - p_term("t_RS", T_CRS) p_term("t_IS", T_CIS) p_term("t_ke", T_KE) p_term("t_ks", T_KS) @@ -3193,10 +3193,13 @@ static struct vimoption options[] = p_term("t_op", T_OP) p_term("t_RB", T_RBG) p_term("t_RI", T_CRI) + p_term("t_RS", T_CRS) p_term("t_RV", T_CRV) p_term("t_Sb", T_CSB) + p_term("t_SC", T_CSC) p_term("t_se", T_SE) p_term("t_Sf", T_CSF) + p_term("t_SH", T_CSH) p_term("t_SI", T_CSI) p_term("t_so", T_SO) p_term("t_SR", T_CSR) @@ -3211,9 +3214,9 @@ static struct vimoption options[] = p_term("t_vb", T_VB) p_term("t_ve", T_VE) p_term("t_vi", T_VI) + p_term("t_VS", T_CVS) p_term("t_vs", T_VS) p_term("t_WP", T_CWP) - p_term("t_GP", T_CGP) p_term("t_WS", T_CWS) p_term("t_xn", T_XN) p_term("t_xs", T_XS) @@ -3221,8 +3224,6 @@ static struct vimoption options[] = p_term("t_ZR", T_CZR) p_term("t_8f", T_8F) p_term("t_8b", T_8B) - p_term("t_BE", T_BE) - p_term("t_BD", T_BD) /* terminal key codes are not in here */ diff --git a/src/proto/term.pro b/src/proto/term.pro --- a/src/proto/term.pro +++ b/src/proto/term.pro @@ -53,7 +53,6 @@ void cursor_on(void); void cursor_off(void); void term_cursor_mode(int forced); void term_cursor_color(char_u *color); -void term_cursor_blink(int blink); void term_cursor_shape(int shape, int blink); void scroll_region_set(win_T *wp, int off); void scroll_region_reset(void); diff --git a/src/term.c b/src/term.c --- a/src/term.c +++ b/src/term.c @@ -828,17 +828,13 @@ static struct builtin_term builtin_termc {(int)KS_LE, "\b"}, {(int)KS_VI, IF_EB("\033[?25l", ESC_STR "[?25l")}, {(int)KS_VE, IF_EB("\033[?25h", ESC_STR "[?25h")}, -#if 0 - /* This is currently disabled, because we cannot reliably restore the - * cursor style because of what appears to be an xterm bug. */ - {(int)KS_VE, IF_EB("\033[?25h\033[?12l", ESC_STR "[?25h" ESC_STR "[?12l")}, {(int)KS_VS, IF_EB("\033[?12h", ESC_STR "[?12h")}, + {(int)KS_CVS, IF_EB("\033[?12l", ESC_STR "[?12l")}, # ifdef TERMINFO {(int)KS_CSH, IF_EB("\033[%p1%d q", ESC_STR "[%p1%d q")}, # else {(int)KS_CSH, IF_EB("\033[%d q", ESC_STR "[%d q")}, # endif -#endif {(int)KS_CRS, IF_EB("\033P$q q\033\\", ESC_STR "P$q q" ESC_STR "\\")}, # ifdef TERMINFO {(int)KS_CM, IF_EB("\033[%i%p1%d;%p2%dH", @@ -1585,7 +1581,7 @@ set_termname(char_u *term) {KS_DL, "dl"}, {KS_CDL,"DL"}, {KS_CS, "cs"}, {KS_CL, "cl"}, {KS_CD, "cd"}, {KS_VI, "vi"}, {KS_VE, "ve"}, {KS_MB, "mb"}, - {KS_VS, "vs"}, {KS_ME, "me"}, {KS_MR, "mr"}, + {KS_ME, "me"}, {KS_MR, "mr"}, {KS_MD, "md"}, {KS_SE, "se"}, {KS_SO, "so"}, {KS_CZH,"ZH"}, {KS_CZR,"ZR"}, {KS_UE, "ue"}, {KS_US, "us"}, {KS_UCE, "Ce"}, {KS_UCS, "Cs"}, @@ -1595,6 +1591,7 @@ set_termname(char_u *term) {KS_BC, "bc"}, {KS_CSB,"Sb"}, {KS_CSF,"Sf"}, {KS_CAB,"AB"}, {KS_CAF,"AF"}, {KS_LE, "le"}, {KS_ND, "nd"}, {KS_OP, "op"}, {KS_CRV, "RV"}, + {KS_VS, "vs"}, {KS_CVS, "VS"}, {KS_CIS, "IS"}, {KS_CIE, "IE"}, {KS_CSC, "SC"}, {KS_CEC, "EC"}, {KS_TS, "ts"}, {KS_FS, "fs"}, @@ -3665,11 +3662,11 @@ mouse_model_popup(void) void scroll_start(void) { - if (*T_VS != NUL) + if (*T_VS != NUL && *T_CVS != NUL) { out_str(T_VS); - out_str(T_VE); - screen_start(); /* don't know where cursor is now */ + out_str(T_CVS); + screen_start(); /* don't know where cursor is now */ } } @@ -3694,10 +3691,9 @@ cursor_on(void) void cursor_off(void) { - if (full_screen) + if (full_screen && !cursor_is_off) { - if (!cursor_is_off) - out_str(T_VI); /* disable cursor */ + out_str(T_VI); /* disable cursor */ cursor_is_off = TRUE; } } @@ -3766,20 +3762,10 @@ term_cursor_color(char_u *color) out_flush(); } } - - void -term_cursor_blink(int blink) -{ - if (blink) - out_str(T_VS); - else - out_str(T_VE); - out_flush(); -} # endif /* - * "shape" == 1: block, "shape" == 2: underline, "shape" == 3: vertical bar + * "shape": 1 = block, 2 = underline, 3 = vertical bar */ void term_cursor_shape(int shape, int blink) @@ -3789,6 +3775,17 @@ term_cursor_shape(int shape, int blink) OUT_STR(tgoto((char *)T_CSH, 0, shape * 2 - blink)); out_flush(); } + /* When t_SH is not set try setting just the blink state. */ + else if (blink && *T_VS != NUL) + { + out_str(T_VS); + out_flush(); + } + else if (!blink && *T_CVS != NUL) + { + out_str(T_CVS); + out_flush(); + } } #endif @@ -4693,7 +4690,9 @@ check_termcode( * 5 = vertical bar blink, 6 = vertical bar */ number = number == 0 ? 1 : number; initial_cursor_shape = (number + 1) / 2; - initial_cursor_blink = (number & 1) ? TRUE : FALSE; + /* The blink flag is actually inverted, compared to + * the value set with T_SH. */ + initial_cursor_blink = (number & 1) ? FALSE : TRUE; rcm_status = STATUS_GOT; LOG_TR("Received cursor shape response"); diff --git a/src/term.h b/src/term.h --- a/src/term.h +++ b/src/term.h @@ -39,7 +39,8 @@ enum SpecialKey KS_DB, /* text may be scrolled up from down */ KS_VI, /* cursor invisible */ KS_VE, /* cursor visible */ - KS_VS, /* cursor very visible */ + KS_VS, /* cursor very visible (blink) */ + KS_CVS, /* cursor normally visible (no blink) */ KS_CSH, /* cursor shape */ KS_CRS, /* request cursor shape */ KS_ME, /* normal mode */ @@ -131,7 +132,8 @@ extern char_u *(term_strings[]); /* c #define T_DB (TERM_STR(KS_DB)) /* text may be scrolled up from down */ #define T_VI (TERM_STR(KS_VI)) /* cursor invisible */ #define T_VE (TERM_STR(KS_VE)) /* cursor visible */ -#define T_VS (TERM_STR(KS_VS)) /* cursor very visible */ +#define T_VS (TERM_STR(KS_VS)) /* cursor very visible (blink) */ +#define T_CVS (TERM_STR(KS_CVS)) /* cursor normally visible (no blink) */ #define T_CSH (TERM_STR(KS_CSH)) /* cursor shape */ #define T_CRS (TERM_STR(KS_CRS)) /* request cursor shape */ #define T_ME (TERM_STR(KS_ME)) /* normal mode */ diff --git a/src/terminal.c b/src/terminal.c --- a/src/terminal.c +++ b/src/terminal.c @@ -38,7 +38,6 @@ * in tl_scrollback are no longer used. * * TODO: - * - help index for winptydll, optwin entry for winptydll * - make [range]terminal pipe [range] lines to the terminal * - implement term_setsize() * - add test for giving error for invalid 'termsize' value. @@ -1271,8 +1270,6 @@ may_set_cursor_props(term_T *term) term_cursor_color(term->tl_cursor_color); else term_cursor_color((char_u *)""); - /* do both blink and shape+blink, in case setting shape does not work */ - term_cursor_blink(term->tl_cursor_blink); term_cursor_shape(term->tl_cursor_shape, term->tl_cursor_blink); } } @@ -1288,7 +1285,6 @@ may_restore_cursor_props(void) { did_change_cursor = FALSE; term_cursor_color((char_u *)""); - term_cursor_blink(FALSE); /* this will restore the initial cursor style, if possible */ ui_cursor_shape_forced(TRUE); } diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -770,6 +770,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 973, +/**/ 972, /**/ 971,