]> git.pld-linux.org Git - packages/vim.git/blob - 5.7.015
official patches for vim.
[packages/vim.git] / 5.7.015
1 To: vim-dev@vim.org
2 Subject: Patch 5.7.015
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 ------------
6
7 Patch 5.7.015
8 Problem:    Syntax files for Vim 6.0 can't be used with 5.x.
9 Solution:   Add the "default" argument to the ":highlight" command: Ignore the
10             command if highlighting was already specified.  
11 Files:      src/syntax.c
12
13
14 *** ../vim-5.7.14/src/syntax.c  Mon May 22 09:42:51 2000
15 --- src/syntax.c        Wed Nov  8 19:33:11 2000
16 ***************
17 *** 78,83 ****
18 --- 78,84 ----
19   static int highlight_list_arg __ARGS((int id, int didh, int type, int iarg, char_u *sarg, char *name));
20   static int syn_add_group __ARGS((char_u *name));
21   static int syn_list_header __ARGS((int did_header, int outlen, int id));
22 + static int hl_has_settings __ARGS((int idx, int check_link));
23   static void highlight_clear __ARGS((int idx));
24   
25   #ifdef USE_GUI
26 ***************
27 *** 4841,4846 ****
28 --- 4842,4848 ----
29       int               attr;
30       int               id;
31       int               idx;
32 +     int               dodefault = FALSE;
33       int               doclear = FALSE;
34       int               dolink = FALSE;
35       int               error = FALSE;
36 ***************
37 *** 4868,4873 ****
38 --- 4870,4886 ----
39       name_end = skiptowhite(line);
40       linep = skipwhite(name_end);
41   
42 +     /*
43 +      * Check for "default" argument.
44 +      */
45 +     if (STRNCMP(line, "default", name_end - line) == 0)
46 +     {
47 +       dodefault = TRUE;
48 +       line = linep;
49 +       name_end = skiptowhite(line);
50 +       linep = skipwhite(name_end);
51 +     }
52
53       if (STRNCMP(line, "clear", name_end - line) == 0)
54         doclear = TRUE;
55       if (STRNCMP(line, "link", name_end - line) == 0)
56 ***************
57 *** 4927,4940 ****
58              * for the group, unless '!' is used
59              */
60             if (to_id > 0 && !forceit && !init
61 !                   &&    (HL_TABLE()[from_id - 1].sg_term_attr != 0
62 !                       || HL_TABLE()[from_id - 1].sg_cterm_attr != 0
63 ! #ifdef USE_GUI
64 !                       || HL_TABLE()[from_id - 1].sg_gui_attr != 0
65 ! #endif
66 !                      ))
67             {
68 !               if (sourcing_name == NULL)
69                     EMSG("group has settings, highlight link ignored");
70             }
71             else
72 --- 4940,4948 ----
73              * for the group, unless '!' is used
74              */
75             if (to_id > 0 && !forceit && !init
76 !                                  && hl_has_settings(from_id - 1, dodefault))
77             {
78 !               if (sourcing_name == NULL && !dodefault)
79                     EMSG("group has settings, highlight link ignored");
80             }
81             else
82 ***************
83 *** 4971,4976 ****
84 --- 4979,4989 ----
85       if (id == 0)                      /* failed (out of memory) */
86         return;
87       idx = id - 1;                     /* index is ID minus one */
88
89 +     /* Return if "default" was used and the group already has settings. */
90 +     if (dodefault && hl_has_settings(idx, TRUE))
91 +       return;
92
93       if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0)
94         is_normal_group = TRUE;
95   #ifdef USE_GUI_X11
96 ***************
97 *** 5473,5478 ****
98 --- 5486,5509 ----
99       /* Only call highlight_changed() once, after sourcing a syntax file */
100       need_highlight_changed = TRUE;
101   }
102
103 + /*
104 +  * Return TRUE if highlight group "idx" has any settings.
105 +  * When "check_link" is TRUE also check for an existing link.
106 +  */
107 +     static int
108 + hl_has_settings(idx, check_link)
109 +     int               idx;
110 +     int               check_link;
111 + {
112 +     return (   HL_TABLE()[idx].sg_term_attr != 0
113 +           || HL_TABLE()[idx].sg_cterm_attr != 0
114 + #ifdef FEAT_GUI
115 +           || HL_TABLE()[idx].sg_gui_attr != 0
116 + #endif
117 +           || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK)));
118 + }
119
120   
121   /*
122    * Clear highlighting for one group.
123 *** ../vim-5.7.14/src/version.c Wed Nov  1 09:55:17 2000
124 --- src/version.c       Wed Nov  8 19:33:20 2000
125 ***************
126 *** 439,440 ****
127 --- 439,442 ----
128   {   /* Add new patch number below this line */
129 + /**/
130 +     15,
131   /**/
132
133 -- 
134 Time is money.  Especially if you make clocks.
135
136 ///  Bram Moolenaar     Bram@moolenaar.net     http://www.moolenaar.net  \\\
137 \\\  Vim: http://www.vim.org      ICCF Holland: http://iccf-holland.org  ///
This page took 0.039226 seconds and 3 git commands to generate.