To: vim_dev@googlegroups.com Subject: Patch 8.0.1532 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1532 Problem: Compiler warnings without termguicolors feature. Solution: Add #ifdef. (John Marriott) Cleanup the code a bit. Files: src/term.c *** ../vim-8.0.1531/src/term.c 2018-02-22 21:06:44.570818781 +0100 --- src/term.c 2018-02-23 18:20:17.731954931 +0100 *************** *** 6624,6632 **** } } struct ks_tbl_s { ! int code; /* value of KS_ */ char *vtp; /* code in vtp mode */ char *buf; /* buffer in non-vtp mode */ char *vbuf; /* buffer in vtp mode */ --- 6624,6633 ---- } } + # ifdef FEAT_TERMGUICOLORS struct ks_tbl_s { ! int code; /* value of KS_ */ char *vtp; /* code in vtp mode */ char *buf; /* buffer in non-vtp mode */ char *vbuf; /* buffer in vtp mode */ *************** *** 6649,6667 **** static struct builtin_term * find_first_tcap( char_u *name, ! int code) { struct builtin_term *p; ! p = find_builtin_term(name); ! while (p->bt_string != NULL) ! { if (p->bt_entry == code) return p; - p++; - } return NULL; } /* * For Win32 console: replace the sequence immediately after termguicolors. --- 6650,6665 ---- static struct builtin_term * find_first_tcap( char_u *name, ! int code) { struct builtin_term *p; ! for (p = find_builtin_term(name); p->bt_string != NULL; ++p) if (p->bt_entry == code) return p; return NULL; } + # endif /* * For Win32 console: replace the sequence immediately after termguicolors. *************** *** 6670,6692 **** swap_tcap(void) { # ifdef FEAT_TERMGUICOLORS ! static int init = 0; ! static int last_tgc; ! struct ks_tbl_s *ks; struct builtin_term *bt; /* buffer initialization */ ! if (init == 0) { ! ks = ks_tbl; ! while (ks->vtp != NULL) { bt = find_first_tcap(DEFAULT_TERM, ks->code); ! ks->buf = bt->bt_string; ! ks->vbuf = ks->vtp; ! ks++; } ! init++; last_tgc = p_tgc; return; } --- 6668,6691 ---- swap_tcap(void) { # ifdef FEAT_TERMGUICOLORS ! static int init_done = FALSE; ! static int last_tgc; ! struct ks_tbl_s *ks; struct builtin_term *bt; /* buffer initialization */ ! if (!init_done) { ! for (ks = ks_tbl; ks->vtp != NULL; ks++) { bt = find_first_tcap(DEFAULT_TERM, ks->code); ! if (bt != NULL) ! { ! ks->buf = bt->bt_string; ! ks->vbuf = ks->vtp; ! } } ! init_done = TRUE; last_tgc = p_tgc; return; } *************** *** 6696,6720 **** if (p_tgc) { /* switch to special character sequence */ ! ks = ks_tbl; ! while (ks->vtp != NULL) { bt = find_first_tcap(DEFAULT_TERM, ks->code); ! ks->buf = bt->bt_string; ! bt->bt_string = ks->vbuf; ! ks++; } } else { /* switch to index color */ ! ks = ks_tbl; ! while (ks->vtp != NULL) { bt = find_first_tcap(DEFAULT_TERM, ks->code); ! ks->vbuf = bt->bt_string; ! bt->bt_string = ks->buf; ! ks++; } } --- 6695,6721 ---- if (p_tgc) { /* switch to special character sequence */ ! for (ks = ks_tbl; ks->vtp != NULL; ks++) { bt = find_first_tcap(DEFAULT_TERM, ks->code); ! if (bt != NULL) ! { ! ks->buf = bt->bt_string; ! bt->bt_string = ks->vbuf; ! } } } else { /* switch to index color */ ! for (ks = ks_tbl; ks->vtp != NULL; ks++) { bt = find_first_tcap(DEFAULT_TERM, ks->code); ! if (bt != NULL) ! { ! ks->vbuf = bt->bt_string; ! bt->bt_string = ks->buf; ! } } } *** ../vim-8.0.1531/src/version.c 2018-02-22 21:06:44.570818781 +0100 --- src/version.c 2018-02-23 18:21:33.819487525 +0100 *************** *** 780,781 **** --- 780,783 ---- { /* Add new patch number below this line */ + /**/ + 1532, /**/ -- ARTHUR: No, hang on! Just answer the five questions ... GALAHAD: Three questions ... ARTHUR: Three questions ... And we shall watch ... and pray. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///