0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.1.0015: cursor color wrong when closing a terminal window

Problem:    Cursor color wrong when closing a terminal window, ending up in
            another terminal window. (Dominique Pelle)
Solution:   Bail out of terminal_loop() when the buffer changes.
            (closes #2942)
This commit is contained in:
Bram Moolenaar
2018-05-21 18:48:12 +02:00
parent 6053f2d29a
commit 05af9a4191
2 changed files with 18 additions and 12 deletions

View File

@@ -183,13 +183,6 @@ static int desired_cursor_blink = -1;
* 1. Generic code for all systems. * 1. Generic code for all systems.
*/ */
static void
cursor_color_copy(char_u** to_color, char_u* from_color)
{
vim_free(*to_color);
*to_color = (from_color == NULL) ? NULL : vim_strsave(from_color);
}
static int static int
cursor_color_equal(char_u *lhs_color, char_u *rhs_color) cursor_color_equal(char_u *lhs_color, char_u *rhs_color)
{ {
@@ -198,6 +191,16 @@ cursor_color_equal(char_u *lhs_color, char_u *rhs_color)
return lhs_color == NULL && rhs_color == NULL; return lhs_color == NULL && rhs_color == NULL;
} }
static void
cursor_color_copy(char_u **to_color, char_u *from_color)
{
// Avoid a free & alloc if the value is already right.
if (cursor_color_equal(*to_color, from_color))
return;
vim_free(*to_color);
*to_color = (from_color == NULL) ? NULL : vim_strsave(from_color);
}
static char_u * static char_u *
cursor_color_get(char_u *color) cursor_color_get(char_u *color)
{ {
@@ -2119,7 +2122,7 @@ terminal_loop(int blocking)
while (must_redraw != 0) while (must_redraw != 0)
if (update_screen(0) == FAIL) if (update_screen(0) == FAIL)
break; break;
if (!term_use_loop_check(TRUE)) if (!term_use_loop_check(TRUE) || in_terminal_loop != curbuf->b_term)
/* job finished while redrawing */ /* job finished while redrawing */
break; break;
@@ -2127,7 +2130,7 @@ terminal_loop(int blocking)
restore_cursor = TRUE; restore_cursor = TRUE;
c = term_vgetc(); c = term_vgetc();
if (!term_use_loop_check(TRUE)) if (!term_use_loop_check(TRUE) || in_terminal_loop != curbuf->b_term)
{ {
/* Job finished while waiting for a character. Push back the /* Job finished while waiting for a character. Push back the
* received character. */ * received character. */
@@ -2178,7 +2181,8 @@ terminal_loop(int blocking)
#ifdef FEAT_CMDL_INFO #ifdef FEAT_CMDL_INFO
clear_showcmd(); clear_showcmd();
#endif #endif
if (!term_use_loop_check(TRUE)) if (!term_use_loop_check(TRUE)
|| in_terminal_loop != curbuf->b_term)
/* job finished while waiting for a character */ /* job finished while waiting for a character */
break; break;

View File

@@ -761,6 +761,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
15,
/**/ /**/
14, 14,
/**/ /**/