0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.0.1532: compiler warnings without termguicolors feature

Problem:    Compiler warnings without termguicolors feature.
Solution:   Add #ifdef. (John Marriott)  Cleanup the code a bit.
This commit is contained in:
Bram Moolenaar
2018-02-23 18:23:30 +01:00
parent cafafb381a
commit cc0f2be880
2 changed files with 30 additions and 27 deletions

View File

@@ -6624,9 +6624,10 @@ update_tcap(int attr)
} }
} }
# ifdef FEAT_TERMGUICOLORS
struct ks_tbl_s struct ks_tbl_s
{ {
int code; /* value of KS_ */ int code; /* value of KS_ */
char *vtp; /* code in vtp mode */ char *vtp; /* code in vtp mode */
char *buf; /* buffer in non-vtp mode */ char *buf; /* buffer in non-vtp mode */
char *vbuf; /* buffer in vtp mode */ char *vbuf; /* buffer in vtp mode */
@@ -6649,19 +6650,16 @@ static struct ks_tbl_s ks_tbl[] =
static struct builtin_term * static struct builtin_term *
find_first_tcap( find_first_tcap(
char_u *name, char_u *name,
int code) int code)
{ {
struct builtin_term *p; struct builtin_term *p;
p = find_builtin_term(name); for (p = find_builtin_term(name); p->bt_string != NULL; ++p)
while (p->bt_string != NULL)
{
if (p->bt_entry == code) if (p->bt_entry == code)
return p; return p;
p++;
}
return NULL; return NULL;
} }
# endif
/* /*
* For Win32 console: replace the sequence immediately after termguicolors. * For Win32 console: replace the sequence immediately after termguicolors.
@@ -6670,23 +6668,24 @@ find_first_tcap(
swap_tcap(void) swap_tcap(void)
{ {
# ifdef FEAT_TERMGUICOLORS # ifdef FEAT_TERMGUICOLORS
static int init = 0; static int init_done = FALSE;
static int last_tgc; static int last_tgc;
struct ks_tbl_s *ks; struct ks_tbl_s *ks;
struct builtin_term *bt; struct builtin_term *bt;
/* buffer initialization */ /* buffer initialization */
if (init == 0) if (!init_done)
{ {
ks = ks_tbl; for (ks = ks_tbl; ks->vtp != NULL; ks++)
while (ks->vtp != NULL)
{ {
bt = find_first_tcap(DEFAULT_TERM, ks->code); bt = find_first_tcap(DEFAULT_TERM, ks->code);
ks->buf = bt->bt_string; if (bt != NULL)
ks->vbuf = ks->vtp; {
ks++; ks->buf = bt->bt_string;
ks->vbuf = ks->vtp;
}
} }
init++; init_done = TRUE;
last_tgc = p_tgc; last_tgc = p_tgc;
return; return;
} }
@@ -6696,25 +6695,27 @@ swap_tcap(void)
if (p_tgc) if (p_tgc)
{ {
/* switch to special character sequence */ /* switch to special character sequence */
ks = ks_tbl; for (ks = ks_tbl; ks->vtp != NULL; ks++)
while (ks->vtp != NULL)
{ {
bt = find_first_tcap(DEFAULT_TERM, ks->code); bt = find_first_tcap(DEFAULT_TERM, ks->code);
ks->buf = bt->bt_string; if (bt != NULL)
bt->bt_string = ks->vbuf; {
ks++; ks->buf = bt->bt_string;
bt->bt_string = ks->vbuf;
}
} }
} }
else else
{ {
/* switch to index color */ /* switch to index color */
ks = ks_tbl; for (ks = ks_tbl; ks->vtp != NULL; ks++)
while (ks->vtp != NULL)
{ {
bt = find_first_tcap(DEFAULT_TERM, ks->code); bt = find_first_tcap(DEFAULT_TERM, ks->code);
ks->vbuf = bt->bt_string; if (bt != NULL)
bt->bt_string = ks->buf; {
ks++; ks->vbuf = bt->bt_string;
bt->bt_string = ks->buf;
}
} }
} }

View File

@@ -778,6 +778,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 */
/**/
1532,
/**/ /**/
1531, 1531,
/**/ /**/