To: vim_dev@googlegroups.com Subject: Patch 8.0.0914 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.0914 Problem: Highlight attributes are always combined. Solution: Add the 'nocombine' value to replace attributes instead of combining them. (scauligi, closes #1963) Files: runtime/doc/syntax.txt, src/syntax.c, src/vim.h *** ../vim-8.0.0913/runtime/doc/syntax.txt 2017-02-23 19:00:28.500904278 +0100 --- runtime/doc/syntax.txt 2017-08-12 15:01:09.627946078 +0200 *************** *** 4660,4665 **** --- 4699,4705 ---- *bold* *underline* *undercurl* *inverse* *italic* *standout* + *nocombine* term={attr-list} *attr-list* *highlight-term* *E418* attr-list is a comma separated list (without spaces) of the following items (in any order): *************** *** 4670,4675 **** --- 4710,4716 ---- inverse same as reverse italic standout + nocombine override attributes instead of combining them NONE no attributes used (used to reset it) Note that "bold" can be used here and by using a bold font. They *** ../vim-8.0.0913/src/syntax.c 2017-08-01 18:03:59.830694237 +0200 --- src/syntax.c 2017-08-12 15:04:15.774848435 +0200 *************** *** 86,94 **** */ static char *(hl_name_table[]) = {"bold", "standout", "underline", "undercurl", ! "italic", "reverse", "inverse", "NONE"}; static int hl_attr_table[] = ! {HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, HL_INVERSE, 0}; static int get_attr_entry(garray_T *table, attrentry_T *aep); static void syn_unadd_group(void); --- 86,95 ---- */ static char *(hl_name_table[]) = {"bold", "standout", "underline", "undercurl", ! "italic", "reverse", "inverse", "nocombine", "NONE"}; static int hl_attr_table[] = ! {HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_NOCOMBINE, 0}; ! #define ATTR_COMBINE(attr_a, attr_b) ((((attr_b) & HL_NOCOMBINE) ? attr_b : (attr_a)) | (attr_b)) static int get_attr_entry(garray_T *table, attrentry_T *aep); static void syn_unadd_group(void); *************** *** 8912,8918 **** if (char_attr == 0) return prim_attr; if (char_attr <= HL_ALL && prim_attr <= HL_ALL) ! return char_attr | prim_attr; #ifdef FEAT_GUI if (gui.in_use) { --- 8913,8919 ---- if (char_attr == 0) return prim_attr; if (char_attr <= HL_ALL && prim_attr <= HL_ALL) ! return ATTR_COMBINE(char_attr, prim_attr); #ifdef FEAT_GUI if (gui.in_use) { *************** *** 8931,8943 **** } if (prim_attr <= HL_ALL) ! new_en.ae_attr |= prim_attr; else { spell_aep = syn_gui_attr2entry(prim_attr); if (spell_aep != NULL) { ! new_en.ae_attr |= spell_aep->ae_attr; if (spell_aep->ae_u.gui.fg_color != INVALCOLOR) new_en.ae_u.gui.fg_color = spell_aep->ae_u.gui.fg_color; if (spell_aep->ae_u.gui.bg_color != INVALCOLOR) --- 8932,8945 ---- } if (prim_attr <= HL_ALL) ! new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); else { spell_aep = syn_gui_attr2entry(prim_attr); if (spell_aep != NULL) { ! new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, ! spell_aep->ae_attr); if (spell_aep->ae_u.gui.fg_color != INVALCOLOR) new_en.ae_u.gui.fg_color = spell_aep->ae_u.gui.fg_color; if (spell_aep->ae_u.gui.bg_color != INVALCOLOR) *************** *** 8974,8986 **** } if (prim_attr <= HL_ALL) ! new_en.ae_attr |= prim_attr; else { spell_aep = syn_cterm_attr2entry(prim_attr); if (spell_aep != NULL) { ! new_en.ae_attr |= spell_aep->ae_attr; if (spell_aep->ae_u.cterm.fg_color > 0) new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; if (spell_aep->ae_u.cterm.bg_color > 0) --- 8976,8989 ---- } if (prim_attr <= HL_ALL) ! new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); else { spell_aep = syn_cterm_attr2entry(prim_attr); if (spell_aep != NULL) { ! new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, ! spell_aep->ae_attr); if (spell_aep->ae_u.cterm.fg_color > 0) new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; if (spell_aep->ae_u.cterm.bg_color > 0) *************** *** 9008,9020 **** } if (prim_attr <= HL_ALL) ! new_en.ae_attr |= prim_attr; else { spell_aep = syn_term_attr2entry(prim_attr); if (spell_aep != NULL) { ! new_en.ae_attr |= spell_aep->ae_attr; if (spell_aep->ae_u.term.start != NULL) { new_en.ae_u.term.start = spell_aep->ae_u.term.start; --- 9011,9023 ---- } if (prim_attr <= HL_ALL) ! new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); else { spell_aep = syn_term_attr2entry(prim_attr); if (spell_aep != NULL) { ! new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, spell_aep->ae_attr); if (spell_aep->ae_u.term.start != NULL) { new_en.ae_u.term.start = spell_aep->ae_u.term.start; *** ../vim-8.0.0913/src/vim.h 2017-08-06 15:22:10.305211941 +0200 --- src/vim.h 2017-08-12 14:57:18.125317271 +0200 *************** *** 680,686 **** #define HL_UNDERLINE 0x08 #define HL_UNDERCURL 0x10 #define HL_STANDOUT 0x20 ! #define HL_ALL 0x3f /* special attribute addition: Put message in history */ #define MSG_HIST 0x1000 --- 680,687 ---- #define HL_UNDERLINE 0x08 #define HL_UNDERCURL 0x10 #define HL_STANDOUT 0x20 ! #define HL_NOCOMBINE 0x40 ! #define HL_ALL 0x7f /* special attribute addition: Put message in history */ #define MSG_HIST 0x1000 *** ../vim-8.0.0913/src/version.c 2017-08-12 14:52:11.743135398 +0200 --- src/version.c 2017-08-12 14:59:15.576621338 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 914, /**/ -- A parent can be arrested if his child cannot hold back a burp during a church service. [real standing law in Nebraska, United States of America] /// 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 ///