Mercurial > vim
annotate src/highlight.c @ 20667:a126f643d566 v8.2.0887
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Commit: https://github.com/vim/vim/commit/57f75a5a364ad4d8334fdf6b6b41420b48e08390
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 2 22:06:21 2020 +0200
patch 8.2.0887: searchcount().exact_match is 1 right after a match
Problem: Searchcount().exact_match is 1 right after a match.
Solution: Use LT_POS() instead of LTOREQ_POS(). (closes https://github.com/vim/vim/issues/6189)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 02 Jun 2020 22:15:04 +0200 |
parents | 68c206d3a251 |
children | 0ebd431a2256 |
rev | line source |
---|---|
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2 * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3 * VIM - Vi IMproved by Bram Moolenaar |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4 * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
5 * Do ":help uganda" in Vim to read copying and usage conditions. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
6 * Do ":help credits" in Vim to see a list of people who contributed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
7 * See README.txt for an overview of the Vim source code. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
8 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
9 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
10 /* |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
11 * Highlighting stuff. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
12 * Includes highlighting matches. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
13 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
14 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
15 #include "vim.h" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
17 #define SG_TERM 1 // term has been set |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
18 #define SG_CTERM 2 // cterm has been set |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
19 #define SG_GUI 4 // gui has been set |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 #define SG_LINK 8 // link has been set |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
21 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 * The "term", "cterm" and "gui" arguments can be any combination of the |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 * following names, separated by commas (but no spaces!). |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
25 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 static char *(hl_name_table[]) = |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
27 {"bold", "standout", "underline", "undercurl", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
28 "italic", "reverse", "inverse", "nocombine", "strikethrough", "NONE"}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 static int hl_attr_table[] = |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
30 {HL_BOLD, HL_STANDOUT, HL_UNDERLINE, HL_UNDERCURL, HL_ITALIC, HL_INVERSE, HL_INVERSE, HL_NOCOMBINE, HL_STRIKETHROUGH, 0}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 #define ATTR_COMBINE(attr_a, attr_b) ((((attr_b) & HL_NOCOMBINE) ? attr_b : (attr_a)) | (attr_b)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
32 |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
33 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
34 * Structure that stores information about a highlight group. |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
35 * The ID of a highlight group is also called group ID. It is the index in |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
36 * the highlight_ga array PLUS ONE. |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
37 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
38 typedef struct |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
39 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
40 char_u *sg_name; // highlight group name |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
41 char_u *sg_name_u; // uppercase of sg_name |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
42 int sg_cleared; // "hi clear" was used |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
43 // for normal terminals |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
44 int sg_term; // "term=" highlighting attributes |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
45 char_u *sg_start; // terminal string for start highl |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
46 char_u *sg_stop; // terminal string for stop highl |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
47 int sg_term_attr; // Screen attr for term mode |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
48 // for color terminals |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
49 int sg_cterm; // "cterm=" highlighting attr |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
50 int sg_cterm_bold; // bold attr was set for light color |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
51 int sg_cterm_fg; // terminal fg color number + 1 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
52 int sg_cterm_bg; // terminal bg color number + 1 |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
53 int sg_cterm_ul; // terminal ul color number + 1 |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
54 int sg_cterm_attr; // Screen attr for color term mode |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
55 // for when using the GUI |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
56 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
57 guicolor_T sg_gui_fg; // GUI foreground color handle |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
58 guicolor_T sg_gui_bg; // GUI background color handle |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
59 guicolor_T sg_gui_sp; // GUI special color handle |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
60 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
61 #ifdef FEAT_GUI |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
62 GuiFont sg_font; // GUI font handle |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
63 #ifdef FEAT_XFONTSET |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
64 GuiFontset sg_fontset; // GUI fontset handle |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
65 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
66 char_u *sg_font_name; // GUI font or fontset name |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
67 int sg_gui_attr; // Screen attr for GUI mode |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
68 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
69 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
70 // Store the sp color name for the GUI or synIDattr() |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
71 int sg_gui; // "gui=" highlighting attributes |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
72 char_u *sg_gui_fg_name;// GUI foreground color name |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
73 char_u *sg_gui_bg_name;// GUI background color name |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
74 char_u *sg_gui_sp_name;// GUI special color name |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
75 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
76 int sg_link; // link to this highlight group ID |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
77 int sg_set; // combination of SG_* flags |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
78 #ifdef FEAT_EVAL |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
79 sctx_T sg_script_ctx; // script in which the group was last set |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
80 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
81 } hl_group_T; |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
82 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
83 // highlight groups for 'highlight' option |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
84 static garray_T highlight_ga; |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
85 #define HL_TABLE() ((hl_group_T *)((highlight_ga.ga_data))) |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
86 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
87 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
88 * An attribute number is the index in attr_table plus ATTR_OFF. |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
89 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
90 #define ATTR_OFF (HL_ALL + 1) |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
91 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
92 static void syn_unadd_group(void); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
93 static void set_hl_attr(int idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 static void highlight_list_one(int id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
95 static int highlight_list_arg(int id, int didh, int type, int iarg, char_u *sarg, char *name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
96 static int syn_add_group(char_u *name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 static int hl_has_settings(int idx, int check_link); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 static void highlight_clear(int idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 static void gui_do_one_color(int idx, int do_menu, int do_tooltip); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
102 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
103 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
104 static int set_group_colors(char_u *name, guicolor_T *fgp, guicolor_T *bgp, int do_menu, int use_norm, int do_tooltip); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 static void hl_do_font(int idx, char_u *arg, int do_normal, int do_menu, int do_tooltip, int free_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
106 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
107 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
108 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
109 * The default highlight groups. These are compiled-in for fast startup and |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
110 * they still work when the runtime files can't be found. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
111 * When making changes here, also change runtime/colors/default.vim! |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
112 * The #ifdefs are needed to reduce the amount of static data. Helps to make |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
113 * the 16 bit DOS (museum) version compile. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
114 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
115 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
116 # define CENT(a, b) b |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
117 #else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
118 # define CENT(a, b) a |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
119 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
120 static char *(highlight_init_both[]) = { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
121 CENT("ErrorMsg term=standout ctermbg=DarkRed ctermfg=White", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
122 "ErrorMsg term=standout ctermbg=DarkRed ctermfg=White guibg=Red guifg=White"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
123 CENT("IncSearch term=reverse cterm=reverse", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
124 "IncSearch term=reverse cterm=reverse gui=reverse"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
125 CENT("ModeMsg term=bold cterm=bold", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
126 "ModeMsg term=bold cterm=bold gui=bold"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
127 CENT("NonText term=bold ctermfg=Blue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
128 "NonText term=bold ctermfg=Blue gui=bold guifg=Blue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
129 CENT("StatusLine term=reverse,bold cterm=reverse,bold", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
130 "StatusLine term=reverse,bold cterm=reverse,bold gui=reverse,bold"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
131 CENT("StatusLineNC term=reverse cterm=reverse", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
132 "StatusLineNC term=reverse cterm=reverse gui=reverse"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
133 "default link EndOfBuffer NonText", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
134 CENT("VertSplit term=reverse cterm=reverse", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
135 "VertSplit term=reverse cterm=reverse gui=reverse"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
136 #ifdef FEAT_CLIPBOARD |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
137 CENT("VisualNOS term=underline,bold cterm=underline,bold", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
138 "VisualNOS term=underline,bold cterm=underline,bold gui=underline,bold"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
139 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
140 #ifdef FEAT_DIFF |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
141 CENT("DiffText term=reverse cterm=bold ctermbg=Red", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
142 "DiffText term=reverse cterm=bold ctermbg=Red gui=bold guibg=Red"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
143 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
144 CENT("PmenuSbar ctermbg=Grey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
145 "PmenuSbar ctermbg=Grey guibg=Grey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
146 CENT("TabLineSel term=bold cterm=bold", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
147 "TabLineSel term=bold cterm=bold gui=bold"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
148 CENT("TabLineFill term=reverse cterm=reverse", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
149 "TabLineFill term=reverse cterm=reverse gui=reverse"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
150 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
151 "Cursor guibg=fg guifg=bg", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
152 "lCursor guibg=fg guifg=bg", // should be different, but what? |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
153 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
154 "default link QuickFixLine Search", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
155 CENT("Normal cterm=NONE", "Normal gui=NONE"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
156 NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
157 }; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
158 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
159 // Default colors only used with a light background. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
160 static char *(highlight_init_light[]) = { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
161 CENT("Directory term=bold ctermfg=DarkBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
162 "Directory term=bold ctermfg=DarkBlue guifg=Blue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
163 CENT("LineNr term=underline ctermfg=Brown", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
164 "LineNr term=underline ctermfg=Brown guifg=Brown"), |
18068
1101eacc1444
patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents:
17809
diff
changeset
|
165 CENT("CursorLineNr term=bold cterm=underline ctermfg=Brown", |
1101eacc1444
patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents:
17809
diff
changeset
|
166 "CursorLineNr term=bold cterm=underline ctermfg=Brown gui=bold guifg=Brown"), |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
167 CENT("MoreMsg term=bold ctermfg=DarkGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
168 "MoreMsg term=bold ctermfg=DarkGreen gui=bold guifg=SeaGreen"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
169 CENT("Question term=standout ctermfg=DarkGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
170 "Question term=standout ctermfg=DarkGreen gui=bold guifg=SeaGreen"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
171 CENT("Search term=reverse ctermbg=Yellow ctermfg=NONE", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
172 "Search term=reverse ctermbg=Yellow ctermfg=NONE guibg=Yellow guifg=NONE"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
173 #ifdef FEAT_SPELL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
174 CENT("SpellBad term=reverse ctermbg=LightRed", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
175 "SpellBad term=reverse ctermbg=LightRed guisp=Red gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
176 CENT("SpellCap term=reverse ctermbg=LightBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
177 "SpellCap term=reverse ctermbg=LightBlue guisp=Blue gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
178 CENT("SpellRare term=reverse ctermbg=LightMagenta", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
179 "SpellRare term=reverse ctermbg=LightMagenta guisp=Magenta gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
180 CENT("SpellLocal term=underline ctermbg=Cyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
181 "SpellLocal term=underline ctermbg=Cyan guisp=DarkCyan gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
182 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
183 CENT("PmenuThumb ctermbg=Black", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
184 "PmenuThumb ctermbg=Black guibg=Black"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
185 CENT("Pmenu ctermbg=LightMagenta ctermfg=Black", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
186 "Pmenu ctermbg=LightMagenta ctermfg=Black guibg=LightMagenta"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
187 CENT("PmenuSel ctermbg=LightGrey ctermfg=Black", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
188 "PmenuSel ctermbg=LightGrey ctermfg=Black guibg=Grey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
189 CENT("SpecialKey term=bold ctermfg=DarkBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
190 "SpecialKey term=bold ctermfg=DarkBlue guifg=Blue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
191 CENT("Title term=bold ctermfg=DarkMagenta", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
192 "Title term=bold ctermfg=DarkMagenta gui=bold guifg=Magenta"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 CENT("WarningMsg term=standout ctermfg=DarkRed", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
194 "WarningMsg term=standout ctermfg=DarkRed guifg=Red"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
195 #ifdef FEAT_WILDMENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
196 CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
197 "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
198 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 #ifdef FEAT_FOLDING |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
200 CENT("Folded term=standout ctermbg=Grey ctermfg=DarkBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 "Folded term=standout ctermbg=Grey ctermfg=DarkBlue guibg=LightGrey guifg=DarkBlue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 CENT("FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 "FoldColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
205 #ifdef FEAT_SIGNS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
206 CENT("SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
207 "SignColumn term=standout ctermbg=Grey ctermfg=DarkBlue guibg=Grey guifg=DarkBlue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 CENT("Visual term=reverse", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 "Visual term=reverse guibg=LightGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
211 #ifdef FEAT_DIFF |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
212 CENT("DiffAdd term=bold ctermbg=LightBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 "DiffAdd term=bold ctermbg=LightBlue guibg=LightBlue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
214 CENT("DiffChange term=bold ctermbg=LightMagenta", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
215 "DiffChange term=bold ctermbg=LightMagenta guibg=LightMagenta"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 CENT("DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
217 "DiffDelete term=bold ctermfg=Blue ctermbg=LightCyan gui=bold guifg=Blue guibg=LightCyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
218 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 CENT("TabLine term=underline cterm=underline ctermfg=black ctermbg=LightGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
220 "TabLine term=underline cterm=underline ctermfg=black ctermbg=LightGrey gui=underline guibg=LightGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 #ifdef FEAT_SYN_HL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
222 CENT("CursorColumn term=reverse ctermbg=LightGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
223 "CursorColumn term=reverse ctermbg=LightGrey guibg=Grey90"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 CENT("CursorLine term=underline cterm=underline", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
225 "CursorLine term=underline cterm=underline guibg=Grey90"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
226 CENT("ColorColumn term=reverse ctermbg=LightRed", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
227 "ColorColumn term=reverse ctermbg=LightRed guibg=LightRed"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
228 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
229 #ifdef FEAT_CONCEAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
230 CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
231 "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
232 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
233 CENT("MatchParen term=reverse ctermbg=Cyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 "MatchParen term=reverse ctermbg=Cyan guibg=Cyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
235 #ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
236 CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
237 "StatusLineTerm term=reverse,bold cterm=bold ctermfg=White ctermbg=DarkGreen gui=bold guifg=bg guibg=DarkGreen"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 CENT("StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
239 "StatusLineTermNC term=reverse ctermfg=White ctermbg=DarkGreen guifg=bg guibg=DarkGreen"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
240 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
241 #ifdef FEAT_MENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 CENT("ToolbarLine term=underline ctermbg=LightGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
243 "ToolbarLine term=underline ctermbg=LightGrey guibg=LightGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
244 CENT("ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=Grey40"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
247 NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
248 }; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
249 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
250 // Default colors only used with a dark background. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
251 static char *(highlight_init_dark[]) = { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 CENT("Directory term=bold ctermfg=LightCyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
253 "Directory term=bold ctermfg=LightCyan guifg=Cyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
254 CENT("LineNr term=underline ctermfg=Yellow", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 "LineNr term=underline ctermfg=Yellow guifg=Yellow"), |
18068
1101eacc1444
patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents:
17809
diff
changeset
|
256 CENT("CursorLineNr term=bold cterm=underline ctermfg=Yellow", |
1101eacc1444
patch 8.1.2029: cannot control 'cursorline' highlighting well
Bram Moolenaar <Bram@vim.org>
parents:
17809
diff
changeset
|
257 "CursorLineNr term=bold cterm=underline ctermfg=Yellow gui=bold guifg=Yellow"), |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
258 CENT("MoreMsg term=bold ctermfg=LightGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
259 "MoreMsg term=bold ctermfg=LightGreen gui=bold guifg=SeaGreen"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
260 CENT("Question term=standout ctermfg=LightGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
261 "Question term=standout ctermfg=LightGreen gui=bold guifg=Green"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
262 CENT("Search term=reverse ctermbg=Yellow ctermfg=Black", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
263 "Search term=reverse ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
264 CENT("SpecialKey term=bold ctermfg=LightBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 "SpecialKey term=bold ctermfg=LightBlue guifg=Cyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
266 #ifdef FEAT_SPELL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 CENT("SpellBad term=reverse ctermbg=Red", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 "SpellBad term=reverse ctermbg=Red guisp=Red gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 CENT("SpellCap term=reverse ctermbg=Blue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
270 "SpellCap term=reverse ctermbg=Blue guisp=Blue gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
271 CENT("SpellRare term=reverse ctermbg=Magenta", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
272 "SpellRare term=reverse ctermbg=Magenta guisp=Magenta gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
273 CENT("SpellLocal term=underline ctermbg=Cyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
274 "SpellLocal term=underline ctermbg=Cyan guisp=Cyan gui=undercurl"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
275 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
276 CENT("PmenuThumb ctermbg=White", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
277 "PmenuThumb ctermbg=White guibg=White"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
278 CENT("Pmenu ctermbg=Magenta ctermfg=Black", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
279 "Pmenu ctermbg=Magenta ctermfg=Black guibg=Magenta"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
280 CENT("PmenuSel ctermbg=Black ctermfg=DarkGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
281 "PmenuSel ctermbg=Black ctermfg=DarkGrey guibg=DarkGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
282 CENT("Title term=bold ctermfg=LightMagenta", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
283 "Title term=bold ctermfg=LightMagenta gui=bold guifg=Magenta"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
284 CENT("WarningMsg term=standout ctermfg=LightRed", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
285 "WarningMsg term=standout ctermfg=LightRed guifg=Red"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
286 #ifdef FEAT_WILDMENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
287 CENT("WildMenu term=standout ctermbg=Yellow ctermfg=Black", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
288 "WildMenu term=standout ctermbg=Yellow ctermfg=Black guibg=Yellow guifg=Black"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
289 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
290 #ifdef FEAT_FOLDING |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
291 CENT("Folded term=standout ctermbg=DarkGrey ctermfg=Cyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
292 "Folded term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=DarkGrey guifg=Cyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 CENT("FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
294 "FoldColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
295 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
296 #ifdef FEAT_SIGNS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
297 CENT("SignColumn term=standout ctermbg=DarkGrey ctermfg=Cyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
298 "SignColumn term=standout ctermbg=DarkGrey ctermfg=Cyan guibg=Grey guifg=Cyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
299 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
300 CENT("Visual term=reverse", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
301 "Visual term=reverse guibg=DarkGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
302 #ifdef FEAT_DIFF |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
303 CENT("DiffAdd term=bold ctermbg=DarkBlue", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
304 "DiffAdd term=bold ctermbg=DarkBlue guibg=DarkBlue"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
305 CENT("DiffChange term=bold ctermbg=DarkMagenta", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
306 "DiffChange term=bold ctermbg=DarkMagenta guibg=DarkMagenta"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
307 CENT("DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
308 "DiffDelete term=bold ctermfg=Blue ctermbg=DarkCyan gui=bold guifg=Blue guibg=DarkCyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
309 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
310 CENT("TabLine term=underline cterm=underline ctermfg=white ctermbg=DarkGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
311 "TabLine term=underline cterm=underline ctermfg=white ctermbg=DarkGrey gui=underline guibg=DarkGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
312 #ifdef FEAT_SYN_HL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 CENT("CursorColumn term=reverse ctermbg=DarkGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
314 "CursorColumn term=reverse ctermbg=DarkGrey guibg=Grey40"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
315 CENT("CursorLine term=underline cterm=underline", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
316 "CursorLine term=underline cterm=underline guibg=Grey40"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
317 CENT("ColorColumn term=reverse ctermbg=DarkRed", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
318 "ColorColumn term=reverse ctermbg=DarkRed guibg=DarkRed"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
320 CENT("MatchParen term=reverse ctermbg=DarkCyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
321 "MatchParen term=reverse ctermbg=DarkCyan guibg=DarkCyan"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
322 #ifdef FEAT_CONCEAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
323 CENT("Conceal ctermbg=DarkGrey ctermfg=LightGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
324 "Conceal ctermbg=DarkGrey ctermfg=LightGrey guibg=DarkGrey guifg=LightGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
325 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
326 #ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 CENT("StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
328 "StatusLineTerm term=reverse,bold cterm=bold ctermfg=Black ctermbg=LightGreen gui=bold guifg=bg guibg=LightGreen"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
329 CENT("StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
330 "StatusLineTermNC term=reverse ctermfg=Black ctermbg=LightGreen guifg=bg guibg=LightGreen"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
331 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
332 #ifdef FEAT_MENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
333 CENT("ToolbarLine term=underline ctermbg=DarkGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
334 "ToolbarLine term=underline ctermbg=DarkGrey guibg=Grey50"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
335 CENT("ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
336 "ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey gui=bold guifg=Black guibg=LightGrey"), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
338 NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
339 }; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
340 |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
341 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
342 * Returns the number of highlight groups. |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
343 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
344 int |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
345 highlight_num_groups(void) |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
346 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
347 return highlight_ga.ga_len; |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
348 } |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
349 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
350 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
351 * Returns the name of a highlight group. |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
352 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
353 char_u * |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
354 highlight_group_name(int id) |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
355 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
356 return HL_TABLE()[id].sg_name; |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
357 } |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
358 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
359 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
360 * Returns the ID of the link to a highlight group. |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
361 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
362 int |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
363 highlight_link_id(int id) |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
364 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
365 return HL_TABLE()[id].sg_link; |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
366 } |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
367 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
368 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
369 init_highlight( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
370 int both, // include groups where 'bg' doesn't matter |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
371 int reset) // clear group first |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
372 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
373 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
374 char **pp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
375 static int had_both = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
376 #ifdef FEAT_EVAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
377 char_u *p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
378 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
379 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
380 * Try finding the color scheme file. Used when a color file was loaded |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
381 * and 'background' or 't_Co' is changed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
382 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
383 p = get_var_value((char_u *)"g:colors_name"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 if (p != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
385 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
386 // The value of g:colors_name could be freed when sourcing the script, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
387 // making "p" invalid, so copy it. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
388 char_u *copy_p = vim_strsave(p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
389 int r; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
390 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
391 if (copy_p != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
392 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
393 r = load_colors(copy_p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
394 vim_free(copy_p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
395 if (r == OK) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
396 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
397 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
398 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
399 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
400 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
401 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
403 * Didn't use a color file, use the compiled-in colors. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
404 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
405 if (both) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
406 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
407 had_both = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 pp = highlight_init_both; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
409 for (i = 0; pp[i] != NULL; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
410 do_highlight((char_u *)pp[i], reset, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
411 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
412 else if (!had_both) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
413 // Don't do anything before the call with both == TRUE from main(). |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
414 // Not everything has been setup then, and that call will overrule |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
415 // everything anyway. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
417 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
418 if (*p_bg == 'l') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
419 pp = highlight_init_light; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
420 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
421 pp = highlight_init_dark; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
422 for (i = 0; pp[i] != NULL; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
423 do_highlight((char_u *)pp[i], reset, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
424 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
425 // Reverse looks ugly, but grey may not work for 8 colors. Thus let it |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 // depend on the number of colors available. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
427 // With 8 colors brown is equal to yellow, need to use black for Search fg |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
428 // to avoid Statement highlighted text disappears. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
429 // Clear the attributes, needed when changing the t_Co value. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
430 if (t_colors > 8) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
431 do_highlight((char_u *)(*p_bg == 'l' |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 ? "Visual cterm=NONE ctermbg=LightGrey" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
433 : "Visual cterm=NONE ctermbg=DarkGrey"), FALSE, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
434 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
435 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
436 do_highlight((char_u *)"Visual cterm=reverse ctermbg=NONE", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
437 FALSE, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 if (*p_bg == 'l') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
439 do_highlight((char_u *)"Search ctermfg=black", FALSE, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
440 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
441 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
442 #ifdef FEAT_SYN_HL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
443 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 * If syntax highlighting is enabled load the highlighting for it. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
445 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
446 if (get_var_value((char_u *)"g:syntax_on") != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
447 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
448 static int recursive = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
449 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
450 if (recursive >= 5) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
451 emsg(_("E679: recursive loop loading syncolor.vim")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
452 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
453 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
454 ++recursive; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
455 (void)source_runtime((char_u *)"syntax/syncolor.vim", DIP_ALL); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
456 --recursive; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
457 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
458 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
459 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
460 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
461 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
462 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
463 * Load color file "name". |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
464 * Return OK for success, FAIL for failure. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
465 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
466 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
467 load_colors(char_u *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
468 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
469 char_u *buf; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
470 int retval = FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
471 static int recursive = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
472 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
473 // When being called recursively, this is probably because setting |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
474 // 'background' caused the highlighting to be reloaded. This means it is |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
475 // working, thus we should return OK. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 if (recursive) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 return OK; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
479 recursive = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
480 buf = alloc(STRLEN(name) + 12); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 if (buf != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 apply_autocmds(EVENT_COLORSCHEMEPRE, name, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
484 curbuf->b_fname, FALSE, curbuf); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
485 sprintf((char *)buf, "colors/%s.vim", name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
486 retval = source_runtime(buf, DIP_START + DIP_OPT); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
487 vim_free(buf); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
488 apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, FALSE, curbuf); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
490 recursive = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
491 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 return retval; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
493 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
494 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
495 static char *(color_names[28]) = { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 "Black", "DarkBlue", "DarkGreen", "DarkCyan", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 "DarkRed", "DarkMagenta", "Brown", "DarkYellow", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
498 "Gray", "Grey", "LightGray", "LightGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 "DarkGray", "DarkGrey", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
500 "Blue", "LightBlue", "Green", "LightGreen", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
501 "Cyan", "LightCyan", "Red", "LightRed", "Magenta", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
502 "LightMagenta", "Yellow", "LightYellow", "White", "NONE"}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 // indices: |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 // 0, 1, 2, 3, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 // 4, 5, 6, 7, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 // 8, 9, 10, 11, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 // 12, 13, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
508 // 14, 15, 16, 17, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 // 18, 19, 20, 21, 22, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 // 23, 24, 25, 26, 27 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 static int color_numbers_16[28] = {0, 1, 2, 3, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
512 4, 5, 6, 6, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
513 7, 7, 7, 7, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
514 8, 8, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
515 9, 9, 10, 10, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 11, 11, 12, 12, 13, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
517 13, 14, 14, 15, -1}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
518 // for xterm with 88 colors... |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
519 static int color_numbers_88[28] = {0, 4, 2, 6, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 1, 5, 32, 72, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 84, 84, 7, 7, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 82, 82, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
523 12, 43, 10, 61, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
524 14, 63, 9, 74, 13, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 75, 11, 78, 15, -1}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
526 // for xterm with 256 colors... |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
527 static int color_numbers_256[28] = {0, 4, 2, 6, |
20160
1acf700beb9c
patch 8.2.0635: when using 256 colors DarkYellow does not show expected color
Bram Moolenaar <Bram@vim.org>
parents:
20116
diff
changeset
|
528 1, 5, 130, 3, |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
529 248, 248, 7, 7, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
530 242, 242, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
531 12, 81, 10, 121, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
532 14, 159, 9, 224, 13, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
533 225, 11, 229, 15, -1}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 // for terminals with less than 16 colors... |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
535 static int color_numbers_8[28] = {0, 4, 2, 6, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
536 1, 5, 3, 3, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
537 7, 7, 7, 7, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 0+8, 0+8, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 4+8, 4+8, 2+8, 2+8, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
540 6+8, 6+8, 1+8, 1+8, 5+8, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
541 5+8, 3+8, 3+8, 7+8, -1}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
542 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
543 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
544 * Lookup the "cterm" value to be used for color with index "idx" in |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 * color_names[]. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
546 * "boldp" will be set to TRUE or FALSE for a foreground color when using 8 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 * colors, otherwise it will be unchanged. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
548 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
550 lookup_color(int idx, int foreground, int *boldp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 int color = color_numbers_16[idx]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 char_u *p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
555 // Use the _16 table to check if it's a valid color name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 if (color < 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 return -1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
558 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
559 if (t_colors == 8) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
561 // t_Co is 8: use the 8 colors table |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
562 #if defined(__QNXNTO__) |
18806
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
563 // On qnx, the 8 & 16 color arrays are the same |
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
564 if (STRNCMP(T_NAME, "qansi", 5) == 0) |
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
565 color = color_numbers_16[idx]; |
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
566 else |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
567 #endif |
18806
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
568 color = color_numbers_8[idx]; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
569 if (foreground) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
570 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
571 // set/reset bold attribute to get light foreground |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
572 // colors (on some terminals, e.g. "linux") |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
573 if (color & 8) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
574 *boldp = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
575 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 *boldp = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
577 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
578 color &= 7; // truncate to 8 colors |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
579 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
580 else if (t_colors == 16 || t_colors == 88 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 || t_colors >= 256) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
582 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
584 * Guess: if the termcap entry ends in 'm', it is |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
585 * probably an xterm-like terminal. Use the changed |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
586 * order for colors. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
587 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
588 if (*T_CAF != NUL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
589 p = T_CAF; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
590 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 p = T_CSF; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
592 if (*p != NUL && (t_colors > 256 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
593 || *(p + STRLEN(p) - 1) == 'm')) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
594 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
595 if (t_colors == 88) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
596 color = color_numbers_88[idx]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
597 else if (t_colors >= 256) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
598 color = color_numbers_256[idx]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
599 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 color = color_numbers_8[idx]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
601 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
602 #ifdef FEAT_TERMRESPONSE |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
603 if (t_colors >= 256 && color == 15 && is_mac_terminal) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
604 // Terminal.app has a bug: 15 is light grey. Use white |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
605 // from the color cube instead. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
606 color = 231; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
607 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
608 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
609 return color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
610 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
611 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
612 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
613 * Handle the ":highlight .." command. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 * When using ":hi clear" this is called recursively for each group with |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
615 * "forceit" and "init" both TRUE. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
616 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
617 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 do_highlight( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
619 char_u *line, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
620 int forceit, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
621 int init) // TRUE when called for initializing |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
622 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
623 char_u *name_end; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
624 char_u *p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
625 char_u *linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
626 char_u *key_start; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
627 char_u *arg_start; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
628 char_u *key = NULL, *arg = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
629 long i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
630 int off; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
631 int len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
632 int attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
633 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
635 hl_group_T item_before; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
636 int did_change = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
637 int dodefault = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
638 int doclear = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
639 int dolink = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
640 int error = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
641 int color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
642 int is_normal_group = FALSE; // "Normal" group |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
643 #ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
644 int is_terminal_group = FALSE; // "Terminal" group |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
645 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 #ifdef FEAT_GUI_X11 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 int is_menu_group = FALSE; // "Menu" group |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
648 int is_scrollbar_group = FALSE; // "Scrollbar" group |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 int is_tooltip_group = FALSE; // "Tooltip" group |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
650 int do_colors = FALSE; // need to update colors? |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
651 #else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
652 # define is_menu_group 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
653 # define is_tooltip_group 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
654 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
656 int did_highlight_changed = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
657 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
659 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
660 * If no argument, list current highlighting. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 */ |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20007
diff
changeset
|
662 if (!init && ends_excmd2(line - 1, line)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
663 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 for (i = 1; i <= highlight_ga.ga_len && !got_int; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
665 // TODO: only call when the group has attributes set |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
666 highlight_list_one((int)i); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
667 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
668 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
669 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
671 * Isolate the name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
672 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 name_end = skiptowhite(line); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 linep = skipwhite(name_end); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
675 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
676 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
677 * Check for "default" argument. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
678 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 if (STRNCMP(line, "default", name_end - line) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
680 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
681 dodefault = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
682 line = linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
683 name_end = skiptowhite(line); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
684 linep = skipwhite(name_end); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
685 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
686 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
687 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
688 * Check for "clear" or "link" argument. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
690 if (STRNCMP(line, "clear", name_end - line) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
691 doclear = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 if (STRNCMP(line, "link", name_end - line) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
693 dolink = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
694 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
695 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
696 * ":highlight {group-name}": list highlighting for one group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
697 */ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
698 if (!doclear && !dolink && ends_excmd2(line, linep)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
699 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
700 id = syn_namen2id(line, (int)(name_end - line)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 if (id == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
702 semsg(_("E411: highlight group not found: %s"), line); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
703 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
704 highlight_list_one(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
705 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
706 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
707 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
709 * Handle ":highlight link {from} {to}" command. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
710 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
711 if (dolink) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
712 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
713 char_u *from_start = linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
714 char_u *from_end; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
715 char_u *to_start; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
716 char_u *to_end; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
717 int from_id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
718 int to_id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
719 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
720 from_end = skiptowhite(from_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
721 to_start = skipwhite(from_end); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
722 to_end = skiptowhite(to_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
723 |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
724 if (ends_excmd2(line, from_start) || ends_excmd2(line, to_start)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
725 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
726 semsg(_("E412: Not enough arguments: \":highlight link %s\""), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
727 from_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
728 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
729 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
730 |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
731 if (!ends_excmd2(line, skipwhite(to_end))) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
732 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
733 semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
734 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
735 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
736 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
737 from_id = syn_check_group(from_start, (int)(from_end - from_start)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
738 if (STRNCMP(to_start, "NONE", 4) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
739 to_id = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
740 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
741 to_id = syn_check_group(to_start, (int)(to_end - to_start)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
742 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
743 if (from_id > 0 && (!init || HL_TABLE()[from_id - 1].sg_set == 0)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
744 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
745 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
746 * Don't allow a link when there already is some highlighting |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
747 * for the group, unless '!' is used |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
748 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
749 if (to_id > 0 && !forceit && !init |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
750 && hl_has_settings(from_id - 1, dodefault)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
751 { |
18991
847cc7932c42
patch 8.2.0056: execution stack is incomplete and inefficient
Bram Moolenaar <Bram@vim.org>
parents:
18953
diff
changeset
|
752 if (SOURCING_NAME == NULL && !dodefault) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
753 emsg(_("E414: group has settings, highlight link ignored")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
754 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
755 else if (HL_TABLE()[from_id - 1].sg_link != to_id |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
756 #ifdef FEAT_EVAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
757 || HL_TABLE()[from_id - 1].sg_script_ctx.sc_sid |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
758 != current_sctx.sc_sid |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
759 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
760 || HL_TABLE()[from_id - 1].sg_cleared) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
761 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
762 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
763 HL_TABLE()[from_id - 1].sg_set |= SG_LINK; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
764 HL_TABLE()[from_id - 1].sg_link = to_id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
765 #ifdef FEAT_EVAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
766 HL_TABLE()[from_id - 1].sg_script_ctx = current_sctx; |
18991
847cc7932c42
patch 8.2.0056: execution stack is incomplete and inefficient
Bram Moolenaar <Bram@vim.org>
parents:
18953
diff
changeset
|
767 HL_TABLE()[from_id - 1].sg_script_ctx.sc_lnum += SOURCING_LNUM; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
768 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
769 HL_TABLE()[from_id - 1].sg_cleared = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
770 redraw_all_later(SOME_VALID); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
771 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
772 // Only call highlight_changed() once after multiple changes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
773 need_highlight_changed = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
774 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
775 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
776 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
777 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
778 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
779 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
780 if (doclear) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
781 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
782 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
783 * ":highlight clear [group]" command. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
784 */ |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
785 if (ends_excmd2(line, linep)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
786 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
787 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
788 // First, we do not destroy the old values, but allocate the new |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
789 // ones and update the display. THEN we destroy the old values. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
790 // If we destroy the old values first, then the old values |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
791 // (such as GuiFont's or GuiFontset's) will still be displayed but |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
792 // invalid because they were free'd. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
793 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
794 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
795 # ifdef FEAT_BEVAL_TIP |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
796 gui_init_tooltip_font(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
797 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
798 # if defined(FEAT_MENU) && (defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MOTIF)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
799 gui_init_menu_font(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
800 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
801 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
802 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_X11) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
803 gui_mch_def_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
804 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
805 # ifdef FEAT_GUI_X11 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
806 # ifdef FEAT_MENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
807 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
808 // This only needs to be done when there is no Menu highlight |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
809 // group defined by default, which IS currently the case. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
810 gui_mch_new_menu_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
811 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
812 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
813 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
814 gui_new_scrollbar_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
815 # ifdef FEAT_BEVAL_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
816 gui_mch_new_tooltip_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
817 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
818 # ifdef FEAT_MENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
819 gui_mch_new_menu_font(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
820 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
821 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
822 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
823 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
824 // Ok, we're done allocating the new default graphics items. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
825 // The screen should already be refreshed at this point. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
826 // It is now Ok to clear out the old data. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
827 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
828 #ifdef FEAT_EVAL |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
829 do_unlet((char_u *)"g:colors_name", TRUE); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
830 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
831 restore_cterm_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
832 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
833 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
834 * Clear all default highlight groups and load the defaults. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
835 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
836 for (idx = 0; idx < highlight_ga.ga_len; ++idx) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
837 highlight_clear(idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
838 init_highlight(TRUE, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
839 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
840 if (USE_24BIT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
841 highlight_gui_started(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
842 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
843 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
844 highlight_changed(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
845 redraw_later_clear(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
846 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
847 } |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
848 line = linep; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
849 name_end = skiptowhite(line); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
850 linep = skipwhite(name_end); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
851 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
852 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
853 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
854 * Find the group name in the table. If it does not exist yet, add it. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
855 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
856 id = syn_check_group(line, (int)(name_end - line)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
857 if (id == 0) // failed (out of memory) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
858 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
859 idx = id - 1; // index is ID minus one |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
860 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
861 // Return if "default" was used and the group already has settings. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
862 if (dodefault && hl_has_settings(idx, TRUE)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
863 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
864 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
865 // Make a copy so we can check if any attribute actually changed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
866 item_before = HL_TABLE()[idx]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
867 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
868 if (STRCMP(HL_TABLE()[idx].sg_name_u, "NORMAL") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
869 is_normal_group = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
870 #ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
871 else if (STRCMP(HL_TABLE()[idx].sg_name_u, "TERMINAL") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
872 is_terminal_group = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
873 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
874 #ifdef FEAT_GUI_X11 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
875 else if (STRCMP(HL_TABLE()[idx].sg_name_u, "MENU") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
876 is_menu_group = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
877 else if (STRCMP(HL_TABLE()[idx].sg_name_u, "SCROLLBAR") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
878 is_scrollbar_group = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
879 else if (STRCMP(HL_TABLE()[idx].sg_name_u, "TOOLTIP") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
880 is_tooltip_group = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
881 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
882 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
883 // Clear the highlighting for ":hi clear {group}" and ":hi clear". |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
884 if (doclear || (forceit && init)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
885 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
886 highlight_clear(idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
887 if (!doclear) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
888 HL_TABLE()[idx].sg_set = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
889 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
890 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
891 if (!doclear) |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
892 while (!ends_excmd2(line, linep)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
893 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
894 key_start = linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
895 if (*linep == '=') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
896 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
897 semsg(_("E415: unexpected equal sign: %s"), key_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
898 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
899 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
900 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
901 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
902 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
903 * Isolate the key ("term", "ctermfg", "ctermbg", "font", "guifg" or |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
904 * "guibg"). |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
905 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
906 while (*linep && !VIM_ISWHITE(*linep) && *linep != '=') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
907 ++linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
908 vim_free(key); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
909 key = vim_strnsave_up(key_start, (int)(linep - key_start)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
910 if (key == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
911 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
912 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
913 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
914 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
915 linep = skipwhite(linep); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
916 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
917 if (STRCMP(key, "NONE") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
918 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
919 if (!init || HL_TABLE()[idx].sg_set == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
920 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
921 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
922 HL_TABLE()[idx].sg_set |= SG_TERM+SG_CTERM+SG_GUI; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
923 highlight_clear(idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
924 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
925 continue; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
926 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
927 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
928 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
929 * Check for the equal sign. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
930 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
931 if (*linep != '=') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
932 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
933 semsg(_("E416: missing equal sign: %s"), key_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
934 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
935 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
936 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
937 ++linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
938 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
939 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
940 * Isolate the argument. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
941 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
942 linep = skipwhite(linep); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
943 if (*linep == '\'') // guifg='color name' |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
944 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
945 arg_start = ++linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
946 linep = vim_strchr(linep, '\''); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
947 if (linep == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
948 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
949 semsg(_(e_invarg2), key_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
950 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
951 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
952 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
953 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
954 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
955 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
956 arg_start = linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
957 linep = skiptowhite(linep); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
958 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
959 if (linep == arg_start) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
960 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
961 semsg(_("E417: missing argument: %s"), key_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
962 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
963 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
964 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
965 vim_free(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
966 arg = vim_strnsave(arg_start, (int)(linep - arg_start)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
967 if (arg == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
968 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
969 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
970 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
971 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
972 if (*linep == '\'') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
973 ++linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
974 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
975 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
976 * Store the argument. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
977 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
978 if ( STRCMP(key, "TERM") == 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
979 || STRCMP(key, "CTERM") == 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
980 || STRCMP(key, "GUI") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
981 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
982 attr = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
983 off = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
984 while (arg[off] != NUL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
985 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
986 for (i = sizeof(hl_attr_table) / sizeof(int); --i >= 0; ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
987 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
988 len = (int)STRLEN(hl_name_table[i]); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
989 if (STRNICMP(arg + off, hl_name_table[i], len) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
990 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
991 attr |= hl_attr_table[i]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
992 off += len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
993 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
994 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
995 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
996 if (i < 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
997 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
998 semsg(_("E418: Illegal value: %s"), arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
999 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1000 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1001 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1002 if (arg[off] == ',') // another one follows |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1003 ++off; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1004 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1005 if (error) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1006 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1007 if (*key == 'T') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1008 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1009 if (!init || !(HL_TABLE()[idx].sg_set & SG_TERM)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1010 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1011 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1012 HL_TABLE()[idx].sg_set |= SG_TERM; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1013 HL_TABLE()[idx].sg_term = attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1014 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1015 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1016 else if (*key == 'C') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1017 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1018 if (!init || !(HL_TABLE()[idx].sg_set & SG_CTERM)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1019 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1020 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1021 HL_TABLE()[idx].sg_set |= SG_CTERM; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1022 HL_TABLE()[idx].sg_cterm = attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1023 HL_TABLE()[idx].sg_cterm_bold = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1024 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1025 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1026 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1027 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1028 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1029 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1030 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1031 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1032 HL_TABLE()[idx].sg_set |= SG_GUI; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1033 HL_TABLE()[idx].sg_gui = attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1034 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1035 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1036 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1037 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1038 else if (STRCMP(key, "FONT") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1039 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1040 // in non-GUI fonts are simply ignored |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1041 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1042 if (HL_TABLE()[idx].sg_font_name != NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1043 && STRCMP(HL_TABLE()[idx].sg_font_name, arg) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1044 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1045 // Font name didn't change, ignore. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1046 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1047 else if (!gui.shell_created) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1048 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1049 // GUI not started yet, always accept the name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1050 vim_free(HL_TABLE()[idx].sg_font_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1051 HL_TABLE()[idx].sg_font_name = vim_strsave(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1052 did_change = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1053 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1054 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1055 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1056 GuiFont temp_sg_font = HL_TABLE()[idx].sg_font; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1057 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1058 GuiFontset temp_sg_fontset = HL_TABLE()[idx].sg_fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1059 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1060 // First, save the current font/fontset. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1061 // Then try to allocate the font/fontset. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1062 // If the allocation fails, HL_TABLE()[idx].sg_font OR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1063 // sg_fontset will be set to NOFONT or NOFONTSET respectively. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1064 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1065 HL_TABLE()[idx].sg_font = NOFONT; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1066 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1067 HL_TABLE()[idx].sg_fontset = NOFONTSET; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1068 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1069 hl_do_font(idx, arg, is_normal_group, is_menu_group, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1070 is_tooltip_group, FALSE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1071 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1072 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1073 if (HL_TABLE()[idx].sg_fontset != NOFONTSET) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1074 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1075 // New fontset was accepted. Free the old one, if there |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1076 // was one. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1077 gui_mch_free_fontset(temp_sg_fontset); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1078 vim_free(HL_TABLE()[idx].sg_font_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1079 HL_TABLE()[idx].sg_font_name = vim_strsave(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1080 did_change = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1081 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1082 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1083 HL_TABLE()[idx].sg_fontset = temp_sg_fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1084 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1085 if (HL_TABLE()[idx].sg_font != NOFONT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1086 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1087 // New font was accepted. Free the old one, if there was |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1088 // one. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1089 gui_mch_free_font(temp_sg_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1090 vim_free(HL_TABLE()[idx].sg_font_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1091 HL_TABLE()[idx].sg_font_name = vim_strsave(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1092 did_change = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1093 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1094 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1095 HL_TABLE()[idx].sg_font = temp_sg_font; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1096 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1097 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1098 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1099 else if (STRCMP(key, "CTERMFG") == 0 || STRCMP(key, "CTERMBG") == 0 |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1100 || STRCMP(key, "CTERMUL") == 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1101 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1102 if (!init || !(HL_TABLE()[idx].sg_set & SG_CTERM)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1103 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1104 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1105 HL_TABLE()[idx].sg_set |= SG_CTERM; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1106 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1107 // When setting the foreground color, and previously the "bold" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1108 // flag was set for a light color, reset it now |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1109 if (key[5] == 'F' && HL_TABLE()[idx].sg_cterm_bold) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1110 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1111 HL_TABLE()[idx].sg_cterm &= ~HL_BOLD; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1112 HL_TABLE()[idx].sg_cterm_bold = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1113 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1114 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1115 if (VIM_ISDIGIT(*arg)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1116 color = atoi((char *)arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1117 else if (STRICMP(arg, "fg") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1118 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1119 if (cterm_normal_fg_color) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1120 color = cterm_normal_fg_color - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1121 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1122 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1123 emsg(_("E419: FG color unknown")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1124 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1125 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1126 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1127 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1128 else if (STRICMP(arg, "bg") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1129 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1130 if (cterm_normal_bg_color > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1131 color = cterm_normal_bg_color - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1132 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1133 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1134 emsg(_("E420: BG color unknown")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1135 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1136 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1137 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1138 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1139 else if (STRICMP(arg, "ul") == 0) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1140 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1141 if (cterm_normal_ul_color > 0) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1142 color = cterm_normal_ul_color - 1; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1143 else |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1144 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1145 emsg(_("E453: UL color unknown")); |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1146 error = TRUE; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1147 break; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1148 } |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1149 } |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1150 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1151 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1152 int bold = MAYBE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1153 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1154 // reduce calls to STRICMP a bit, it can be slow |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1155 off = TOUPPER_ASC(*arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1156 for (i = (sizeof(color_names) / sizeof(char *)); --i >= 0; ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1157 if (off == color_names[i][0] |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1158 && STRICMP(arg + 1, color_names[i] + 1) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1159 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1160 if (i < 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1161 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1162 semsg(_("E421: Color name or number not recognized: %s"), key_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1163 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1164 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1165 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1166 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1167 color = lookup_color(i, key[5] == 'F', &bold); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1168 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1169 // set/reset bold attribute to get light foreground |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1170 // colors (on some terminals, e.g. "linux") |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1171 if (bold == TRUE) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1172 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1173 HL_TABLE()[idx].sg_cterm |= HL_BOLD; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1174 HL_TABLE()[idx].sg_cterm_bold = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1175 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1176 else if (bold == FALSE) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1177 HL_TABLE()[idx].sg_cterm &= ~HL_BOLD; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1178 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1179 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1180 // Add one to the argument, to avoid zero. Zero is used for |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1181 // "NONE", then "color" is -1. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1182 if (key[5] == 'F') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1183 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1184 HL_TABLE()[idx].sg_cterm_fg = color + 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1185 if (is_normal_group) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1186 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1187 cterm_normal_fg_color = color + 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1188 cterm_normal_fg_bold = (HL_TABLE()[idx].sg_cterm & HL_BOLD); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1189 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1190 // Don't do this if the GUI is used. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1191 if (!gui.in_use && !gui.starting) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1192 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1193 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1194 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1195 if (termcap_active && color >= 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1196 term_fg_color(color); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1197 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1198 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1199 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1200 else if (key[5] == 'B') |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1201 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1202 HL_TABLE()[idx].sg_cterm_bg = color + 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1203 if (is_normal_group) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1204 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1205 cterm_normal_bg_color = color + 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1206 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1207 // Don't mess with 'background' if the GUI is used. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1208 if (!gui.in_use && !gui.starting) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1209 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1210 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1211 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1212 if (color >= 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1213 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1214 int dark = -1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1215 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1216 if (termcap_active) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1217 term_bg_color(color); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1218 if (t_colors < 16) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1219 dark = (color == 0 || color == 4); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1220 // Limit the heuristic to the standard 16 colors |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1221 else if (color < 16) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1222 dark = (color < 7 || color == 8); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1223 // Set the 'background' option if the value is |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1224 // wrong. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1225 if (dark != -1 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1226 && dark != (*p_bg == 'd') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1227 && !option_was_set((char_u *)"bg")) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1228 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1229 set_option_value((char_u *)"bg", 0L, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1230 (char_u *)(dark ? "dark" : "light"), 0); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1231 reset_option_was_set((char_u *)"bg"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1232 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1233 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1234 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1235 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1236 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1237 else // ctermul |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1238 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1239 HL_TABLE()[idx].sg_cterm_ul = color + 1; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1240 if (is_normal_group) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1241 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1242 cterm_normal_ul_color = color + 1; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1243 #ifdef FEAT_GUI |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1244 // Don't do this if the GUI is used. |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1245 if (!gui.in_use && !gui.starting) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1246 #endif |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1247 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1248 must_redraw = CLEAR; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1249 if (termcap_active && color >= 0) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1250 term_ul_color(color); |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1251 } |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1252 } |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1253 } |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1254 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1255 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1256 else if (STRCMP(key, "GUIFG") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1257 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1258 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1259 char_u **namep = &HL_TABLE()[idx].sg_gui_fg_name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1260 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1261 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1262 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1263 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1264 HL_TABLE()[idx].sg_set |= SG_GUI; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1265 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1266 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1267 // In GUI guifg colors are only used when recognized |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1268 i = color_name2handle(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1269 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1270 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1271 HL_TABLE()[idx].sg_gui_fg = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1272 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1273 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1274 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1275 vim_free(*namep); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1276 if (STRCMP(arg, "NONE") != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1277 *namep = vim_strsave(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1278 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1279 *namep = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1280 did_change = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1281 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1282 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1283 # ifdef FEAT_GUI_X11 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1284 if (is_menu_group && gui.menu_fg_pixel != i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1285 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1286 gui.menu_fg_pixel = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1287 do_colors = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1288 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1289 if (is_scrollbar_group && gui.scroll_fg_pixel != i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1290 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1291 gui.scroll_fg_pixel = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1292 do_colors = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1293 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1294 # ifdef FEAT_BEVAL_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1295 if (is_tooltip_group && gui.tooltip_fg_pixel != i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1296 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1297 gui.tooltip_fg_pixel = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1298 do_colors = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1299 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1300 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1301 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1302 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1303 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1304 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1305 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1306 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1307 else if (STRCMP(key, "GUIBG") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1308 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1309 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1310 char_u **namep = &HL_TABLE()[idx].sg_gui_bg_name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1311 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1312 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1313 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1314 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1315 HL_TABLE()[idx].sg_set |= SG_GUI; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1316 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1317 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1318 // In GUI guifg colors are only used when recognized |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1319 i = color_name2handle(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1320 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1321 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1322 HL_TABLE()[idx].sg_gui_bg = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1323 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1324 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1325 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1326 vim_free(*namep); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1327 if (STRCMP(arg, "NONE") != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1328 *namep = vim_strsave(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1329 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1330 *namep = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1331 did_change = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1332 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1333 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1334 # ifdef FEAT_GUI_X11 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1335 if (is_menu_group && gui.menu_bg_pixel != i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1336 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1337 gui.menu_bg_pixel = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1338 do_colors = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1339 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1340 if (is_scrollbar_group && gui.scroll_bg_pixel != i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1341 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1342 gui.scroll_bg_pixel = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1343 do_colors = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1344 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1345 # ifdef FEAT_BEVAL_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1346 if (is_tooltip_group && gui.tooltip_bg_pixel != i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1347 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1348 gui.tooltip_bg_pixel = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1349 do_colors = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1350 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1351 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1352 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1353 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1354 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1355 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1356 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1357 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1358 else if (STRCMP(key, "GUISP") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1359 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1360 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1361 char_u **namep = &HL_TABLE()[idx].sg_gui_sp_name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1362 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1363 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1364 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1365 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1366 HL_TABLE()[idx].sg_set |= SG_GUI; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1367 |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1368 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1369 // In GUI guisp colors are only used when recognized |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1370 i = color_name2handle(arg); |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1371 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1372 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1373 HL_TABLE()[idx].sg_gui_sp = i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1374 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1375 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1376 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1377 vim_free(*namep); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1378 if (STRCMP(arg, "NONE") != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1379 *namep = vim_strsave(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1380 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1381 *namep = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1382 did_change = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1383 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1384 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1385 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1386 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1387 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1388 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1389 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1390 else if (STRCMP(key, "START") == 0 || STRCMP(key, "STOP") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1391 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1392 char_u buf[100]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1393 char_u *tname; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1394 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1395 if (!init) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1396 HL_TABLE()[idx].sg_set |= SG_TERM; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1397 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1398 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1399 * The "start" and "stop" arguments can be a literal escape |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1400 * sequence, or a comma separated list of terminal codes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1401 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1402 if (STRNCMP(arg, "t_", 2) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1403 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1404 off = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1405 buf[0] = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1406 while (arg[off] != NUL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1407 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1408 // Isolate one termcap name |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1409 for (len = 0; arg[off + len] && |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1410 arg[off + len] != ','; ++len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1411 ; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1412 tname = vim_strnsave(arg + off, len); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1413 if (tname == NULL) // out of memory |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1414 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1415 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1416 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1417 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1418 // lookup the escape sequence for the item |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1419 p = get_term_code(tname); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1420 vim_free(tname); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1421 if (p == NULL) // ignore non-existing things |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1422 p = (char_u *)""; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1423 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1424 // Append it to the already found stuff |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1425 if ((int)(STRLEN(buf) + STRLEN(p)) >= 99) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1426 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1427 semsg(_("E422: terminal code too long: %s"), arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1428 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1429 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1430 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1431 STRCAT(buf, p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1432 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1433 // Advance to the next item |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1434 off += len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1435 if (arg[off] == ',') // another one follows |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1436 ++off; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1437 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1438 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1439 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1440 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1441 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1442 * Copy characters from arg[] to buf[], translating <> codes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1443 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1444 for (p = arg, off = 0; off < 100 - 6 && *p; ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1445 { |
20603
c2570baa2e4c
patch 8.2.0855: GUI tests fail because the test doesn't use a modifier
Bram Moolenaar <Bram@vim.org>
parents:
20392
diff
changeset
|
1446 len = trans_special(&p, buf + off, FSK_SIMPLIFY, NULL); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1447 if (len > 0) // recognized special char |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1448 off += len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1449 else // copy as normal char |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1450 buf[off++] = *p++; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1451 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1452 buf[off] = NUL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1453 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1454 if (error) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1455 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1456 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1457 if (STRCMP(buf, "NONE") == 0) // resetting the value |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1458 p = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1459 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1460 p = vim_strsave(buf); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1461 if (key[2] == 'A') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1462 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1463 vim_free(HL_TABLE()[idx].sg_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1464 HL_TABLE()[idx].sg_start = p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1465 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1466 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1467 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1468 vim_free(HL_TABLE()[idx].sg_stop); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1469 HL_TABLE()[idx].sg_stop = p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1470 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1471 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1472 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1473 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1474 semsg(_("E423: Illegal argument: %s"), key_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1475 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1476 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1477 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1478 HL_TABLE()[idx].sg_cleared = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1479 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1480 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1481 * When highlighting has been given for a group, don't link it. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1482 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1483 if (!init || !(HL_TABLE()[idx].sg_set & SG_LINK)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1484 HL_TABLE()[idx].sg_link = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1485 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1486 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1487 * Continue with next argument. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1488 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1489 linep = skipwhite(linep); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1490 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1491 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1492 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1493 * If there is an error, and it's a new entry, remove it from the table. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1494 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1495 if (error && idx == highlight_ga.ga_len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1496 syn_unadd_group(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1497 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1498 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1499 if (is_normal_group) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1500 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1501 HL_TABLE()[idx].sg_term_attr = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1502 HL_TABLE()[idx].sg_cterm_attr = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1503 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1504 HL_TABLE()[idx].sg_gui_attr = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1505 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1506 * Need to update all groups, because they might be using "bg" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1507 * and/or "fg", which have been changed now. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1508 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1509 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1510 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1511 if (USE_24BIT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1512 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1513 highlight_gui_started(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1514 did_highlight_changed = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1515 redraw_all_later(NOT_VALID); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1516 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1517 #endif |
19756
fe90a71a3fed
patch 8.2.0434: MS-Windows with VTP: Normal color not working
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
1518 #ifdef FEAT_VTP |
fe90a71a3fed
patch 8.2.0434: MS-Windows with VTP: Normal color not working
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
1519 control_console_color_rgb(); |
fe90a71a3fed
patch 8.2.0434: MS-Windows with VTP: Normal color not working
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
1520 #endif |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1521 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1522 #ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1523 else if (is_terminal_group) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1524 set_terminal_default_colors( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1525 HL_TABLE()[idx].sg_cterm_fg, HL_TABLE()[idx].sg_cterm_bg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1526 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1527 #ifdef FEAT_GUI_X11 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1528 # ifdef FEAT_MENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1529 else if (is_menu_group) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1530 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1531 if (gui.in_use && do_colors) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1532 gui_mch_new_menu_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1533 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1534 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1535 else if (is_scrollbar_group) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1536 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1537 if (gui.in_use && do_colors) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1538 gui_new_scrollbar_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1539 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1540 set_hl_attr(idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1541 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1542 # ifdef FEAT_BEVAL_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1543 else if (is_tooltip_group) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1544 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1545 if (gui.in_use && do_colors) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1546 gui_mch_new_tooltip_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1547 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1548 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1549 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1550 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1551 set_hl_attr(idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1552 #ifdef FEAT_EVAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1553 HL_TABLE()[idx].sg_script_ctx = current_sctx; |
18991
847cc7932c42
patch 8.2.0056: execution stack is incomplete and inefficient
Bram Moolenaar <Bram@vim.org>
parents:
18953
diff
changeset
|
1554 HL_TABLE()[idx].sg_script_ctx.sc_lnum += SOURCING_LNUM; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1555 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1556 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1557 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1558 vim_free(key); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1559 vim_free(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1560 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1561 // Only call highlight_changed() once, after a sequence of highlight |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1562 // commands, and only if an attribute actually changed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1563 if ((did_change |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1564 || memcmp(&HL_TABLE()[idx], &item_before, sizeof(item_before)) != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1565 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1566 && !did_highlight_changed |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1567 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1568 ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1569 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1570 // Do not trigger a redraw when highlighting is changed while |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1571 // redrawing. This may happen when evaluating 'statusline' changes the |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1572 // StatusLine group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1573 if (!updating_screen) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1574 redraw_all_later(NOT_VALID); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1575 need_highlight_changed = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1576 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1577 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1578 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1579 #if defined(EXITFREE) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1580 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1581 free_highlight(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1582 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1583 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1584 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1585 for (i = 0; i < highlight_ga.ga_len; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1586 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1587 highlight_clear(i); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1588 vim_free(HL_TABLE()[i].sg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1589 vim_free(HL_TABLE()[i].sg_name_u); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1590 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1591 ga_clear(&highlight_ga); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1592 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1593 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1594 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1595 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1596 * Reset the cterm colors to what they were before Vim was started, if |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1597 * possible. Otherwise reset them to zero. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1598 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1599 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1600 restore_cterm_colors(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1601 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1602 #if defined(MSWIN) && !defined(FEAT_GUI_MSWIN) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1603 // Since t_me has been set, this probably means that the user |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1604 // wants to use this as default colors. Need to reset default |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1605 // background/foreground colors. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1606 mch_set_normal_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1607 #else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1608 # ifdef VIMDLL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1609 if (!gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1610 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1611 mch_set_normal_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1612 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1613 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1614 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1615 cterm_normal_fg_color = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1616 cterm_normal_fg_bold = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1617 cterm_normal_bg_color = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1618 # ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1619 cterm_normal_fg_gui_color = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1620 cterm_normal_bg_gui_color = INVALCOLOR; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1621 cterm_normal_ul_gui_color = INVALCOLOR; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1622 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1623 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1624 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1625 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1626 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1627 * Return TRUE if highlight group "idx" has any settings. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1628 * When "check_link" is TRUE also check for an existing link. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1629 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1630 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1631 hl_has_settings(int idx, int check_link) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1632 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1633 return ( HL_TABLE()[idx].sg_term_attr != 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1634 || HL_TABLE()[idx].sg_cterm_attr != 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1635 || HL_TABLE()[idx].sg_cterm_fg != 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1636 || HL_TABLE()[idx].sg_cterm_bg != 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1637 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1638 || HL_TABLE()[idx].sg_gui_attr != 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1639 || HL_TABLE()[idx].sg_gui_fg_name != NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1640 || HL_TABLE()[idx].sg_gui_bg_name != NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1641 || HL_TABLE()[idx].sg_gui_sp_name != NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1642 || HL_TABLE()[idx].sg_font_name != NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1643 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1644 || (check_link && (HL_TABLE()[idx].sg_set & SG_LINK))); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1645 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1646 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1647 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1648 * Clear highlighting for one group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1649 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1650 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1651 highlight_clear(int idx) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1652 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1653 HL_TABLE()[idx].sg_cleared = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1654 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1655 HL_TABLE()[idx].sg_term = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1656 VIM_CLEAR(HL_TABLE()[idx].sg_start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1657 VIM_CLEAR(HL_TABLE()[idx].sg_stop); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1658 HL_TABLE()[idx].sg_term_attr = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1659 HL_TABLE()[idx].sg_cterm = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1660 HL_TABLE()[idx].sg_cterm_bold = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1661 HL_TABLE()[idx].sg_cterm_fg = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1662 HL_TABLE()[idx].sg_cterm_bg = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1663 HL_TABLE()[idx].sg_cterm_attr = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1664 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1665 HL_TABLE()[idx].sg_gui = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1666 VIM_CLEAR(HL_TABLE()[idx].sg_gui_fg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1667 VIM_CLEAR(HL_TABLE()[idx].sg_gui_bg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1668 VIM_CLEAR(HL_TABLE()[idx].sg_gui_sp_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1669 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1670 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1671 HL_TABLE()[idx].sg_gui_fg = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1672 HL_TABLE()[idx].sg_gui_bg = INVALCOLOR; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1673 HL_TABLE()[idx].sg_gui_sp = INVALCOLOR; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1674 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1675 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1676 gui_mch_free_font(HL_TABLE()[idx].sg_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1677 HL_TABLE()[idx].sg_font = NOFONT; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1678 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1679 gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1680 HL_TABLE()[idx].sg_fontset = NOFONTSET; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1681 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1682 VIM_CLEAR(HL_TABLE()[idx].sg_font_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1683 HL_TABLE()[idx].sg_gui_attr = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1684 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1685 #ifdef FEAT_EVAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1686 // Clear the script ID only when there is no link, since that is not |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1687 // cleared. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1688 if (HL_TABLE()[idx].sg_link == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1689 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1690 HL_TABLE()[idx].sg_script_ctx.sc_sid = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1691 HL_TABLE()[idx].sg_script_ctx.sc_lnum = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1692 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1693 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1694 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1695 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1696 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1697 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1698 * Set the normal foreground and background colors according to the "Normal" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1699 * highlighting group. For X11 also set "Menu", "Scrollbar", and |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1700 * "Tooltip" colors. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1701 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1702 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1703 set_normal_colors(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1704 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1705 # ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1706 # ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1707 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1708 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1709 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1710 if (set_group_colors((char_u *)"Normal", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1711 &gui.norm_pixel, &gui.back_pixel, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1712 FALSE, TRUE, FALSE)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1713 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1714 gui_mch_new_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1715 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1716 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1717 # ifdef FEAT_GUI_X11 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1718 if (set_group_colors((char_u *)"Menu", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1719 &gui.menu_fg_pixel, &gui.menu_bg_pixel, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1720 TRUE, FALSE, FALSE)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1721 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1722 # ifdef FEAT_MENU |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1723 gui_mch_new_menu_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1724 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1725 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1726 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1727 # ifdef FEAT_BEVAL_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1728 if (set_group_colors((char_u *)"Tooltip", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1729 &gui.tooltip_fg_pixel, &gui.tooltip_bg_pixel, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1730 FALSE, FALSE, TRUE)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1731 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1732 # ifdef FEAT_TOOLBAR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1733 gui_mch_new_tooltip_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1734 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1735 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1736 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1737 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1738 if (set_group_colors((char_u *)"Scrollbar", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1739 &gui.scroll_fg_pixel, &gui.scroll_bg_pixel, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1740 FALSE, FALSE, FALSE)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1741 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1742 gui_new_scrollbar_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1743 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1744 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1745 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1746 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1747 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1748 # ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1749 # ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1750 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1751 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1752 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1753 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1754 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1755 idx = syn_name2id((char_u *)"Normal") - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1756 if (idx >= 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1757 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1758 gui_do_one_color(idx, FALSE, FALSE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1759 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1760 // If the normal fg or bg color changed a complete redraw is |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1761 // required. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1762 if (cterm_normal_fg_gui_color != HL_TABLE()[idx].sg_gui_fg |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1763 || cterm_normal_bg_gui_color != HL_TABLE()[idx].sg_gui_bg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1764 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1765 // if the GUI color is INVALCOLOR then we use the default cterm |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1766 // color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1767 cterm_normal_fg_gui_color = HL_TABLE()[idx].sg_gui_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1768 cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1769 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1770 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1771 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1772 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1773 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1774 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1775 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1776 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1777 #if defined(FEAT_GUI) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1778 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1779 * Set the colors for "Normal", "Menu", "Tooltip" or "Scrollbar". |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1780 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1781 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1782 set_group_colors( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1783 char_u *name, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1784 guicolor_T *fgp, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1785 guicolor_T *bgp, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1786 int do_menu, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1787 int use_norm, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1788 int do_tooltip) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1789 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1790 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1791 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1792 idx = syn_name2id(name) - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1793 if (idx >= 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1794 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1795 gui_do_one_color(idx, do_menu, do_tooltip); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1796 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1797 if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1798 *fgp = HL_TABLE()[idx].sg_gui_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1799 else if (use_norm) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1800 *fgp = gui.def_norm_pixel; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1801 if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1802 *bgp = HL_TABLE()[idx].sg_gui_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1803 else if (use_norm) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1804 *bgp = gui.def_back_pixel; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1805 return TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1806 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1807 return FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1808 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1809 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1810 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1811 * Get the font of the "Normal" group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1812 * Returns "" when it's not found or not set. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1813 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1814 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1815 hl_get_font_name(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1816 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1817 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1818 char_u *s; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1819 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1820 id = syn_name2id((char_u *)"Normal"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1821 if (id > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1822 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1823 s = HL_TABLE()[id - 1].sg_font_name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1824 if (s != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1825 return s; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1826 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1827 return (char_u *)""; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1828 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1829 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1830 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1831 * Set font for "Normal" group. Called by gui_mch_init_font() when a font has |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1832 * actually chosen to be used. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1833 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1834 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1835 hl_set_font_name(char_u *font_name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1836 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1837 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1838 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1839 id = syn_name2id((char_u *)"Normal"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1840 if (id > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1841 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1842 vim_free(HL_TABLE()[id - 1].sg_font_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1843 HL_TABLE()[id - 1].sg_font_name = vim_strsave(font_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1844 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1845 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1846 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1847 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1848 * Set background color for "Normal" group. Called by gui_set_bg_color() |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1849 * when the color is known. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1850 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1851 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1852 hl_set_bg_color_name( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1853 char_u *name) // must have been allocated |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1854 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1855 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1856 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1857 if (name != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1858 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1859 id = syn_name2id((char_u *)"Normal"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1860 if (id > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1861 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1862 vim_free(HL_TABLE()[id - 1].sg_gui_bg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1863 HL_TABLE()[id - 1].sg_gui_bg_name = name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1864 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1865 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1866 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1867 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1868 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1869 * Set foreground color for "Normal" group. Called by gui_set_fg_color() |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1870 * when the color is known. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1871 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1872 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1873 hl_set_fg_color_name( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1874 char_u *name) // must have been allocated |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1875 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1876 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1877 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1878 if (name != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1879 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1880 id = syn_name2id((char_u *)"Normal"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1881 if (id > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1882 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1883 vim_free(HL_TABLE()[id - 1].sg_gui_fg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1884 HL_TABLE()[id - 1].sg_gui_fg_name = name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1885 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1886 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1887 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1888 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1889 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1890 * Return the handle for a font name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1891 * Returns NOFONT when failed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1892 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1893 static GuiFont |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1894 font_name2handle(char_u *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1895 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1896 if (STRCMP(name, "NONE") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1897 return NOFONT; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1898 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1899 return gui_mch_get_font(name, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1900 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1901 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1902 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1903 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1904 * Return the handle for a fontset name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1905 * Returns NOFONTSET when failed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1906 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1907 static GuiFontset |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1908 fontset_name2handle(char_u *name, int fixed_width) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1909 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1910 if (STRCMP(name, "NONE") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1911 return NOFONTSET; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1912 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1913 return gui_mch_get_fontset(name, TRUE, fixed_width); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1914 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1915 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1916 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1917 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1918 * Get the font or fontset for one highlight group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1919 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1920 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1921 hl_do_font( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1922 int idx, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1923 char_u *arg, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1924 int do_normal, // set normal font |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1925 int do_menu UNUSED, // set menu font |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1926 int do_tooltip UNUSED, // set tooltip font |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1927 int free_font) // free current font/fontset |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1928 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1929 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1930 // If 'guifontset' is not empty, first try using the name as a |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1931 // fontset. If that doesn't work, use it as a font name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1932 if (*p_guifontset != NUL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1933 # ifdef FONTSET_ALWAYS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1934 || do_menu |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1935 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1936 # ifdef FEAT_BEVAL_TIP |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1937 // In Athena & Motif, the Tooltip highlight group is always a fontset |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1938 || do_tooltip |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1939 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1940 ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1941 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1942 if (free_font) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1943 gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1944 HL_TABLE()[idx].sg_fontset = fontset_name2handle(arg, 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1945 # ifdef FONTSET_ALWAYS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1946 || do_menu |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1947 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1948 # ifdef FEAT_BEVAL_TIP |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1949 || do_tooltip |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1950 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1951 ); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1952 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1953 if (HL_TABLE()[idx].sg_fontset != NOFONTSET) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1954 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1955 // If it worked and it's the Normal group, use it as the normal |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1956 // fontset. Same for the Menu group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1957 if (do_normal) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1958 gui_init_font(arg, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1959 # if (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) && defined(FEAT_MENU) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1960 if (do_menu) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1961 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1962 # ifdef FONTSET_ALWAYS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1963 gui.menu_fontset = HL_TABLE()[idx].sg_fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1964 # else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1965 // YIKES! This is a bug waiting to crash the program |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1966 gui.menu_font = HL_TABLE()[idx].sg_fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1967 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1968 gui_mch_new_menu_font(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1969 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1970 # ifdef FEAT_BEVAL_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1971 if (do_tooltip) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1972 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1973 // The Athena widget set cannot currently handle switching between |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1974 // displaying a single font and a fontset. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1975 // If the XtNinternational resource is set to True at widget |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1976 // creation, then a fontset is always used, otherwise an |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1977 // XFontStruct is used. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1978 gui.tooltip_fontset = (XFontSet)HL_TABLE()[idx].sg_fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1979 gui_mch_new_tooltip_font(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1980 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1981 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1982 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1983 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1984 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1985 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1986 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1987 if (free_font) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1988 gui_mch_free_font(HL_TABLE()[idx].sg_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1989 HL_TABLE()[idx].sg_font = font_name2handle(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1990 // If it worked and it's the Normal group, use it as the |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1991 // normal font. Same for the Menu group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1992 if (HL_TABLE()[idx].sg_font != NOFONT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1993 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1994 if (do_normal) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1995 gui_init_font(arg, FALSE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1996 #ifndef FONTSET_ALWAYS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1997 # if (defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_ATHENA)) && defined(FEAT_MENU) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1998 if (do_menu) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1999 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2000 gui.menu_font = HL_TABLE()[idx].sg_font; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2001 gui_mch_new_menu_font(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2002 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2003 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2004 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2005 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2006 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2007 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2008 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2009 #endif // FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2010 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2011 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2012 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2013 * Return the handle for a color name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2014 * Returns INVALCOLOR when failed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2015 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2016 guicolor_T |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2017 color_name2handle(char_u *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2018 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2019 if (STRCMP(name, "NONE") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2020 return INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2021 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2022 if (STRICMP(name, "fg") == 0 || STRICMP(name, "foreground") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2023 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2024 #if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2025 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2026 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2027 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2028 return gui.norm_pixel; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2029 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2030 #ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2031 if (cterm_normal_fg_gui_color != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2032 return cterm_normal_fg_gui_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2033 // Guess that the foreground is black or white. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2034 return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "black" : "white")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2035 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2036 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2037 if (STRICMP(name, "bg") == 0 || STRICMP(name, "background") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2038 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2039 #if defined(FEAT_TERMGUICOLORS) && defined(FEAT_GUI) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2040 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2041 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2042 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2043 return gui.back_pixel; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2044 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2045 #ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2046 if (cterm_normal_bg_gui_color != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2047 return cterm_normal_bg_gui_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2048 // Guess that the background is white or black. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2049 return GUI_GET_COLOR((char_u *)(*p_bg == 'l' ? "white" : "black")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2050 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2051 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2052 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2053 return GUI_GET_COLOR(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2054 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2055 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2056 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2057 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2058 * Table with the specifications for an attribute number. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2059 * Note that this table is used by ALL buffers. This is required because the |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2060 * GUI can redraw at any time for any buffer. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2061 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2062 static garray_T term_attr_table = {0, 0, 0, 0, NULL}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2063 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2064 #define TERM_ATTR_ENTRY(idx) ((attrentry_T *)term_attr_table.ga_data)[idx] |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2065 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2066 static garray_T cterm_attr_table = {0, 0, 0, 0, NULL}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2067 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2068 #define CTERM_ATTR_ENTRY(idx) ((attrentry_T *)cterm_attr_table.ga_data)[idx] |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2069 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2070 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2071 static garray_T gui_attr_table = {0, 0, 0, 0, NULL}; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2072 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2073 #define GUI_ATTR_ENTRY(idx) ((attrentry_T *)gui_attr_table.ga_data)[idx] |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2074 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2075 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2076 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2077 * Return the attr number for a set of colors and font. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2078 * Add a new entry to the term_attr_table, cterm_attr_table or gui_attr_table |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2079 * if the combination is new. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2080 * Return 0 for error (no more room). |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2081 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2082 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2083 get_attr_entry(garray_T *table, attrentry_T *aep) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2084 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2085 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2086 attrentry_T *taep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2087 static int recursive = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2088 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2089 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2090 * Init the table, in case it wasn't done yet. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2091 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2092 table->ga_itemsize = sizeof(attrentry_T); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2093 table->ga_growsize = 7; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2094 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2095 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2096 * Try to find an entry with the same specifications. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2097 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2098 for (i = 0; i < table->ga_len; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2099 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2100 taep = &(((attrentry_T *)table->ga_data)[i]); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2101 if ( aep->ae_attr == taep->ae_attr |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2102 && ( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2103 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2104 (table == &gui_attr_table |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2105 && (aep->ae_u.gui.fg_color == taep->ae_u.gui.fg_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2106 && aep->ae_u.gui.bg_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2107 == taep->ae_u.gui.bg_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2108 && aep->ae_u.gui.sp_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2109 == taep->ae_u.gui.sp_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2110 && aep->ae_u.gui.font == taep->ae_u.gui.font |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2111 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2112 && aep->ae_u.gui.fontset == taep->ae_u.gui.fontset |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2113 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2114 )) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2115 || |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2116 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2117 (table == &term_attr_table |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2118 && (aep->ae_u.term.start == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2119 == (taep->ae_u.term.start == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2120 && (aep->ae_u.term.start == NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2121 || STRCMP(aep->ae_u.term.start, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2122 taep->ae_u.term.start) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2123 && (aep->ae_u.term.stop == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2124 == (taep->ae_u.term.stop == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2125 && (aep->ae_u.term.stop == NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2126 || STRCMP(aep->ae_u.term.stop, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2127 taep->ae_u.term.stop) == 0)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2128 || (table == &cterm_attr_table |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2129 && aep->ae_u.cterm.fg_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2130 == taep->ae_u.cterm.fg_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2131 && aep->ae_u.cterm.bg_color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2132 == taep->ae_u.cterm.bg_color |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2133 && aep->ae_u.cterm.ul_color |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2134 == taep->ae_u.cterm.ul_color |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2135 #ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2136 && aep->ae_u.cterm.fg_rgb |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2137 == taep->ae_u.cterm.fg_rgb |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2138 && aep->ae_u.cterm.bg_rgb |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2139 == taep->ae_u.cterm.bg_rgb |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2140 && aep->ae_u.cterm.ul_rgb |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2141 == taep->ae_u.cterm.ul_rgb |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2142 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2143 ))) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2144 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2145 return i + ATTR_OFF; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2146 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2147 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2148 if (table->ga_len + ATTR_OFF > MAX_TYPENR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2149 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2150 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2151 * Running out of attribute entries! remove all attributes, and |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2152 * compute new ones for all groups. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2153 * When called recursively, we are really out of numbers. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2154 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2155 if (recursive) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2156 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2157 emsg(_("E424: Too many different highlighting attributes in use")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2158 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2159 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2160 recursive = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2161 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2162 clear_hl_tables(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2163 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2164 must_redraw = CLEAR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2165 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2166 for (i = 0; i < highlight_ga.ga_len; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2167 set_hl_attr(i); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2168 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2169 recursive = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2170 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2171 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2172 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2173 * This is a new combination of colors and font, add an entry. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2174 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2175 if (ga_grow(table, 1) == FAIL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2176 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2177 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2178 taep = &(((attrentry_T *)table->ga_data)[table->ga_len]); |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2179 CLEAR_POINTER(taep); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2180 taep->ae_attr = aep->ae_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2181 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2182 if (table == &gui_attr_table) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2183 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2184 taep->ae_u.gui.fg_color = aep->ae_u.gui.fg_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2185 taep->ae_u.gui.bg_color = aep->ae_u.gui.bg_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2186 taep->ae_u.gui.sp_color = aep->ae_u.gui.sp_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2187 taep->ae_u.gui.font = aep->ae_u.gui.font; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2188 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2189 taep->ae_u.gui.fontset = aep->ae_u.gui.fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2190 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2191 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2192 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2193 if (table == &term_attr_table) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2194 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2195 if (aep->ae_u.term.start == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2196 taep->ae_u.term.start = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2197 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2198 taep->ae_u.term.start = vim_strsave(aep->ae_u.term.start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2199 if (aep->ae_u.term.stop == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2200 taep->ae_u.term.stop = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2201 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2202 taep->ae_u.term.stop = vim_strsave(aep->ae_u.term.stop); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2203 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2204 else if (table == &cterm_attr_table) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2205 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2206 taep->ae_u.cterm.fg_color = aep->ae_u.cterm.fg_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2207 taep->ae_u.cterm.bg_color = aep->ae_u.cterm.bg_color; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2208 taep->ae_u.cterm.ul_color = aep->ae_u.cterm.ul_color; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2209 #ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2210 taep->ae_u.cterm.fg_rgb = aep->ae_u.cterm.fg_rgb; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2211 taep->ae_u.cterm.bg_rgb = aep->ae_u.cterm.bg_rgb; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2212 taep->ae_u.cterm.ul_rgb = aep->ae_u.cterm.ul_rgb; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2213 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2214 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2215 ++table->ga_len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2216 return (table->ga_len - 1 + ATTR_OFF); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2217 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2218 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2219 #if defined(FEAT_TERMINAL) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2220 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2221 * Get an attribute index for a cterm entry. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2222 * Uses an existing entry when possible or adds one when needed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2223 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2224 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2225 get_cterm_attr_idx(int attr, int fg, int bg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2226 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2227 attrentry_T at_en; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2228 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2229 CLEAR_FIELD(at_en); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2230 #ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2231 at_en.ae_u.cterm.fg_rgb = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2232 at_en.ae_u.cterm.bg_rgb = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2233 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2234 at_en.ae_attr = attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2235 at_en.ae_u.cterm.fg_color = fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2236 at_en.ae_u.cterm.bg_color = bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2237 return get_attr_entry(&cterm_attr_table, &at_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2238 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2239 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2240 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2241 #if (defined(FEAT_TERMINAL) && defined(FEAT_TERMGUICOLORS)) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2242 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2243 * Get an attribute index for a 'termguicolors' entry. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2244 * Uses an existing entry when possible or adds one when needed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2245 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2246 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2247 get_tgc_attr_idx(int attr, guicolor_T fg, guicolor_T bg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2248 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2249 attrentry_T at_en; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2250 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2251 CLEAR_FIELD(at_en); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2252 at_en.ae_attr = attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2253 if (fg == INVALCOLOR && bg == INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2254 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2255 // If both GUI colors are not set fall back to the cterm colors. Helps |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2256 // if the GUI only has an attribute, such as undercurl. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2257 at_en.ae_u.cterm.fg_rgb = CTERMCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2258 at_en.ae_u.cterm.bg_rgb = CTERMCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2259 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2260 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2261 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2262 at_en.ae_u.cterm.fg_rgb = fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2263 at_en.ae_u.cterm.bg_rgb = bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2264 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2265 return get_attr_entry(&cterm_attr_table, &at_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2266 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2267 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2268 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2269 #if (defined(FEAT_TERMINAL) && defined(FEAT_GUI)) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2270 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2271 * Get an attribute index for a cterm entry. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2272 * Uses an existing entry when possible or adds one when needed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2273 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2274 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2275 get_gui_attr_idx(int attr, guicolor_T fg, guicolor_T bg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2276 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2277 attrentry_T at_en; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2278 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2279 CLEAR_FIELD(at_en); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2280 at_en.ae_attr = attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2281 at_en.ae_u.gui.fg_color = fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2282 at_en.ae_u.gui.bg_color = bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2283 return get_attr_entry(&gui_attr_table, &at_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2284 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2285 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2286 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2287 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2288 * Clear all highlight tables. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2289 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2290 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2291 clear_hl_tables(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2292 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2293 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2294 attrentry_T *taep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2295 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2296 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2297 ga_clear(&gui_attr_table); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2298 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2299 for (i = 0; i < term_attr_table.ga_len; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2300 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2301 taep = &(((attrentry_T *)term_attr_table.ga_data)[i]); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2302 vim_free(taep->ae_u.term.start); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2303 vim_free(taep->ae_u.term.stop); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2304 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2305 ga_clear(&term_attr_table); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2306 ga_clear(&cterm_attr_table); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2307 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2308 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2309 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2310 * Combine special attributes (e.g., for spelling) with other attributes |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2311 * (e.g., for syntax highlighting). |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2312 * "prim_attr" overrules "char_attr". |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2313 * This creates a new group when required. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2314 * Since we expect there to be few spelling mistakes we don't cache the |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2315 * result. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2316 * Return the resulting attributes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2317 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2318 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2319 hl_combine_attr(int char_attr, int prim_attr) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2320 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2321 attrentry_T *char_aep = NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2322 attrentry_T *spell_aep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2323 attrentry_T new_en; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2324 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2325 if (char_attr == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2326 return prim_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2327 if (char_attr <= HL_ALL && prim_attr <= HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2328 return ATTR_COMBINE(char_attr, prim_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2329 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2330 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2331 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2332 if (char_attr > HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2333 char_aep = syn_gui_attr2entry(char_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2334 if (char_aep != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2335 new_en = *char_aep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2336 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2337 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2338 CLEAR_FIELD(new_en); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2339 new_en.ae_u.gui.fg_color = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2340 new_en.ae_u.gui.bg_color = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2341 new_en.ae_u.gui.sp_color = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2342 if (char_attr <= HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2343 new_en.ae_attr = char_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2344 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2345 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2346 if (prim_attr <= HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2347 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2348 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2349 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2350 spell_aep = syn_gui_attr2entry(prim_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2351 if (spell_aep != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2352 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2353 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2354 spell_aep->ae_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2355 if (spell_aep->ae_u.gui.fg_color != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2356 new_en.ae_u.gui.fg_color = spell_aep->ae_u.gui.fg_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2357 if (spell_aep->ae_u.gui.bg_color != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2358 new_en.ae_u.gui.bg_color = spell_aep->ae_u.gui.bg_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2359 if (spell_aep->ae_u.gui.sp_color != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2360 new_en.ae_u.gui.sp_color = spell_aep->ae_u.gui.sp_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2361 if (spell_aep->ae_u.gui.font != NOFONT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2362 new_en.ae_u.gui.font = spell_aep->ae_u.gui.font; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2363 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2364 if (spell_aep->ae_u.gui.fontset != NOFONTSET) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2365 new_en.ae_u.gui.fontset = spell_aep->ae_u.gui.fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2366 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2367 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2368 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2369 return get_attr_entry(&gui_attr_table, &new_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2370 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2371 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2372 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2373 if (IS_CTERM) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2374 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2375 if (char_attr > HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2376 char_aep = syn_cterm_attr2entry(char_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2377 if (char_aep != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2378 new_en = *char_aep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2379 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2380 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2381 CLEAR_FIELD(new_en); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2382 #ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2383 new_en.ae_u.cterm.bg_rgb = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2384 new_en.ae_u.cterm.fg_rgb = INVALCOLOR; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2385 new_en.ae_u.cterm.ul_rgb = INVALCOLOR; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2386 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2387 if (char_attr <= HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2388 new_en.ae_attr = char_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2389 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2390 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2391 if (prim_attr <= HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2392 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2393 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2394 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2395 spell_aep = syn_cterm_attr2entry(prim_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2396 if (spell_aep != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2397 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2398 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2399 spell_aep->ae_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2400 if (spell_aep->ae_u.cterm.fg_color > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2401 new_en.ae_u.cterm.fg_color = spell_aep->ae_u.cterm.fg_color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2402 if (spell_aep->ae_u.cterm.bg_color > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2403 new_en.ae_u.cterm.bg_color = spell_aep->ae_u.cterm.bg_color; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2404 if (spell_aep->ae_u.cterm.ul_color > 0) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2405 new_en.ae_u.cterm.ul_color = spell_aep->ae_u.cterm.ul_color; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2406 #ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2407 // If both fg and bg are not set fall back to cterm colors. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2408 // Helps for SpellBad which uses undercurl in the GUI. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2409 if (COLOR_INVALID(spell_aep->ae_u.cterm.fg_rgb) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2410 && COLOR_INVALID(spell_aep->ae_u.cterm.bg_rgb)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2411 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2412 if (spell_aep->ae_u.cterm.fg_color > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2413 new_en.ae_u.cterm.fg_rgb = CTERMCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2414 if (spell_aep->ae_u.cterm.bg_color > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2415 new_en.ae_u.cterm.bg_rgb = CTERMCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2416 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2417 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2418 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2419 if (spell_aep->ae_u.cterm.fg_rgb != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2420 new_en.ae_u.cterm.fg_rgb = spell_aep->ae_u.cterm.fg_rgb; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2421 if (spell_aep->ae_u.cterm.bg_rgb != INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2422 new_en.ae_u.cterm.bg_rgb = spell_aep->ae_u.cterm.bg_rgb; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2423 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2424 if (spell_aep->ae_u.cterm.ul_rgb != INVALCOLOR) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2425 new_en.ae_u.cterm.ul_rgb = spell_aep->ae_u.cterm.ul_rgb; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2426 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2427 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2428 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2429 return get_attr_entry(&cterm_attr_table, &new_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2430 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2431 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2432 if (char_attr > HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2433 char_aep = syn_term_attr2entry(char_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2434 if (char_aep != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2435 new_en = *char_aep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2436 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2437 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2438 CLEAR_FIELD(new_en); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2439 if (char_attr <= HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2440 new_en.ae_attr = char_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2441 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2442 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2443 if (prim_attr <= HL_ALL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2444 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2445 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2446 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2447 spell_aep = syn_term_attr2entry(prim_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2448 if (spell_aep != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2449 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2450 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, spell_aep->ae_attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2451 if (spell_aep->ae_u.term.start != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2452 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2453 new_en.ae_u.term.start = spell_aep->ae_u.term.start; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2454 new_en.ae_u.term.stop = spell_aep->ae_u.term.stop; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2455 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2456 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2457 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2458 return get_attr_entry(&term_attr_table, &new_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2459 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2460 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2461 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2462 attrentry_T * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2463 syn_gui_attr2entry(int attr) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2464 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2465 attr -= ATTR_OFF; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2466 if (attr >= gui_attr_table.ga_len) // did ":syntax clear" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2467 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2468 return &(GUI_ATTR_ENTRY(attr)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2469 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2470 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2471 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2472 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2473 * Get the highlight attributes (HL_BOLD etc.) from an attribute nr. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2474 * Only to be used when "attr" > HL_ALL. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2475 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2476 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2477 syn_attr2attr(int attr) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2478 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2479 attrentry_T *aep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2480 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2481 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2482 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2483 aep = syn_gui_attr2entry(attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2484 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2485 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2486 if (IS_CTERM) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2487 aep = syn_cterm_attr2entry(attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2488 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2489 aep = syn_term_attr2entry(attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2490 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2491 if (aep == NULL) // highlighting not set |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2492 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2493 return aep->ae_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2494 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2495 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2496 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2497 attrentry_T * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2498 syn_term_attr2entry(int attr) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2499 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2500 attr -= ATTR_OFF; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2501 if (attr >= term_attr_table.ga_len) // did ":syntax clear" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2502 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2503 return &(TERM_ATTR_ENTRY(attr)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2504 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2505 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2506 attrentry_T * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2507 syn_cterm_attr2entry(int attr) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2508 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2509 attr -= ATTR_OFF; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2510 if (attr >= cterm_attr_table.ga_len) // did ":syntax clear" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2511 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2512 return &(CTERM_ATTR_ENTRY(attr)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2513 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2514 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2515 #define LIST_ATTR 1 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2516 #define LIST_STRING 2 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2517 #define LIST_INT 3 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2518 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2519 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2520 highlight_list_one(int id) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2521 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2522 hl_group_T *sgp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2523 int didh = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2524 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2525 sgp = &HL_TABLE()[id - 1]; // index is ID minus one |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2526 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2527 if (message_filtered(sgp->sg_name)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2528 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2529 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2530 didh = highlight_list_arg(id, didh, LIST_ATTR, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2531 sgp->sg_term, NULL, "term"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2532 didh = highlight_list_arg(id, didh, LIST_STRING, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2533 0, sgp->sg_start, "start"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2534 didh = highlight_list_arg(id, didh, LIST_STRING, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2535 0, sgp->sg_stop, "stop"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2536 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2537 didh = highlight_list_arg(id, didh, LIST_ATTR, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2538 sgp->sg_cterm, NULL, "cterm"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2539 didh = highlight_list_arg(id, didh, LIST_INT, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2540 sgp->sg_cterm_fg, NULL, "ctermfg"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2541 didh = highlight_list_arg(id, didh, LIST_INT, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2542 sgp->sg_cterm_bg, NULL, "ctermbg"); |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2543 didh = highlight_list_arg(id, didh, LIST_INT, |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2544 sgp->sg_cterm_ul, NULL, "ctermul"); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2545 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2546 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2547 didh = highlight_list_arg(id, didh, LIST_ATTR, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2548 sgp->sg_gui, NULL, "gui"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2549 didh = highlight_list_arg(id, didh, LIST_STRING, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2550 0, sgp->sg_gui_fg_name, "guifg"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2551 didh = highlight_list_arg(id, didh, LIST_STRING, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2552 0, sgp->sg_gui_bg_name, "guibg"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2553 didh = highlight_list_arg(id, didh, LIST_STRING, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2554 0, sgp->sg_gui_sp_name, "guisp"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2555 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2556 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2557 didh = highlight_list_arg(id, didh, LIST_STRING, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2558 0, sgp->sg_font_name, "font"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2559 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2560 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2561 if (sgp->sg_link && !got_int) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2562 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2563 (void)syn_list_header(didh, 9999, id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2564 didh = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2565 msg_puts_attr("links to", HL_ATTR(HLF_D)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2566 msg_putchar(' '); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2567 msg_outtrans(HL_TABLE()[HL_TABLE()[id - 1].sg_link - 1].sg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2568 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2569 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2570 if (!didh) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2571 highlight_list_arg(id, didh, LIST_STRING, 0, (char_u *)"cleared", ""); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2572 #ifdef FEAT_EVAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2573 if (p_verbose > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2574 last_set_msg(sgp->sg_script_ctx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2575 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2576 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2577 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2578 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2579 highlight_list_arg( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2580 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2581 int didh, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2582 int type, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2583 int iarg, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2584 char_u *sarg, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2585 char *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2586 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2587 char_u buf[100]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2588 char_u *ts; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2589 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2590 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2591 if (got_int) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2592 return FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2593 if (type == LIST_STRING ? (sarg != NULL) : (iarg != 0)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2594 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2595 ts = buf; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2596 if (type == LIST_INT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2597 sprintf((char *)buf, "%d", iarg - 1); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2598 else if (type == LIST_STRING) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2599 ts = sarg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2600 else // type == LIST_ATTR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2601 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2602 buf[0] = NUL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2603 for (i = 0; hl_attr_table[i] != 0; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2604 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2605 if (iarg & hl_attr_table[i]) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2606 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2607 if (buf[0] != NUL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2608 vim_strcat(buf, (char_u *)",", 100); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2609 vim_strcat(buf, (char_u *)hl_name_table[i], 100); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2610 iarg &= ~hl_attr_table[i]; // don't want "inverse" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2611 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2612 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2613 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2614 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2615 (void)syn_list_header(didh, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2616 (int)(vim_strsize(ts) + STRLEN(name) + 1), id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2617 didh = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2618 if (!got_int) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2619 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2620 if (*name != NUL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2621 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2622 msg_puts_attr(name, HL_ATTR(HLF_D)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2623 msg_puts_attr("=", HL_ATTR(HLF_D)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2624 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2625 msg_outtrans(ts); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2626 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2627 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2628 return didh; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2629 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2630 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2631 #if (((defined(FEAT_EVAL) || defined(FEAT_PRINTER))) && defined(FEAT_SYN_HL)) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2632 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2633 * Return "1" if highlight group "id" has attribute "flag". |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2634 * Return NULL otherwise. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2635 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2636 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2637 highlight_has_attr( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2638 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2639 int flag, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2640 int modec) // 'g' for GUI, 'c' for cterm, 't' for term |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2641 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2642 int attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2643 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2644 if (id <= 0 || id > highlight_ga.ga_len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2645 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2646 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2647 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2648 if (modec == 'g') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2649 attr = HL_TABLE()[id - 1].sg_gui; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2650 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2651 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2652 if (modec == 'c') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2653 attr = HL_TABLE()[id - 1].sg_cterm; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2654 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2655 attr = HL_TABLE()[id - 1].sg_term; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2656 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2657 if (attr & flag) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2658 return (char_u *)"1"; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2659 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2660 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2661 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2662 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2663 #if (defined(FEAT_SYN_HL) && defined(FEAT_EVAL)) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2664 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2665 * Return color name of highlight group "id". |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2666 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2667 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2668 highlight_color( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2669 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2670 char_u *what, // "font", "fg", "bg", "sp", "fg#", "bg#" or "sp#" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2671 int modec) // 'g' for GUI, 'c' for cterm, 't' for term |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2672 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2673 static char_u name[20]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2674 int n; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2675 int fg = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2676 int sp = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2677 int font = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2678 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2679 if (id <= 0 || id > highlight_ga.ga_len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2680 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2681 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2682 if (TOLOWER_ASC(what[0]) == 'f' && TOLOWER_ASC(what[1]) == 'g') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2683 fg = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2684 else if (TOLOWER_ASC(what[0]) == 'f' && TOLOWER_ASC(what[1]) == 'o' |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2685 && TOLOWER_ASC(what[2]) == 'n' && TOLOWER_ASC(what[3]) == 't') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2686 font = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2687 else if (TOLOWER_ASC(what[0]) == 's' && TOLOWER_ASC(what[1]) == 'p') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2688 sp = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2689 else if (!(TOLOWER_ASC(what[0]) == 'b' && TOLOWER_ASC(what[1]) == 'g')) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2690 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2691 if (modec == 'g') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2692 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2693 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2694 # ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2695 // return font name |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2696 if (font) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2697 return HL_TABLE()[id - 1].sg_font_name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2698 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2699 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2700 // return #RRGGBB form (only possible when GUI is running) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2701 if ((USE_24BIT) && what[2] == '#') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2702 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2703 guicolor_T color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2704 long_u rgb; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2705 static char_u buf[10]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2706 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2707 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2708 color = HL_TABLE()[id - 1].sg_gui_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2709 else if (sp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2710 color = HL_TABLE()[id - 1].sg_gui_sp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2711 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2712 color = HL_TABLE()[id - 1].sg_gui_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2713 if (color == INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2714 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2715 rgb = (long_u)GUI_MCH_GET_RGB(color); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2716 sprintf((char *)buf, "#%02x%02x%02x", |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2717 (unsigned)(rgb >> 16), |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2718 (unsigned)(rgb >> 8) & 255, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2719 (unsigned)rgb & 255); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2720 return buf; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2721 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2722 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2723 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2724 return (HL_TABLE()[id - 1].sg_gui_fg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2725 if (sp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2726 return (HL_TABLE()[id - 1].sg_gui_sp_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2727 return (HL_TABLE()[id - 1].sg_gui_bg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2728 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2729 if (font || sp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2730 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2731 if (modec == 'c') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2732 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2733 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2734 n = HL_TABLE()[id - 1].sg_cterm_fg - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2735 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2736 n = HL_TABLE()[id - 1].sg_cterm_bg - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2737 if (n < 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2738 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2739 sprintf((char *)name, "%d", n); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2740 return name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2741 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2742 // term doesn't have color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2743 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2744 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2745 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2746 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2747 #if (defined(FEAT_SYN_HL) \ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2748 && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) \ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2749 && defined(FEAT_PRINTER)) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2750 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2751 * Return color name of highlight group "id" as RGB value. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2752 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2753 long_u |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2754 highlight_gui_color_rgb( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2755 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2756 int fg) // TRUE = fg, FALSE = bg |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2757 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2758 guicolor_T color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2759 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2760 if (id <= 0 || id > highlight_ga.ga_len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2761 return 0L; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2762 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2763 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2764 color = HL_TABLE()[id - 1].sg_gui_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2765 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2766 color = HL_TABLE()[id - 1].sg_gui_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2767 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2768 if (color == INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2769 return 0L; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2770 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2771 return GUI_MCH_GET_RGB(color); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2772 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2773 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2774 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2775 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2776 * Output the syntax list header. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2777 * Return TRUE when started a new line. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2778 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2779 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2780 syn_list_header( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2781 int did_header, // did header already |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2782 int outlen, // length of string that comes |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2783 int id) // highlight group id |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2784 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2785 int endcol = 19; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2786 int newline = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2787 int name_col = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2788 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2789 if (!did_header) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2790 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2791 msg_putchar('\n'); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2792 if (got_int) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2793 return TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2794 msg_outtrans(HL_TABLE()[id - 1].sg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2795 name_col = msg_col; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2796 endcol = 15; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2797 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2798 else if (msg_col + outlen + 1 >= Columns) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2799 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2800 msg_putchar('\n'); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2801 if (got_int) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2802 return TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2803 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2804 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2805 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2806 if (msg_col >= endcol) // wrap around is like starting a new line |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2807 newline = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2808 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2809 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2810 if (msg_col >= endcol) // output at least one space |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2811 endcol = msg_col + 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2812 if (Columns <= endcol) // avoid hang for tiny window |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2813 endcol = Columns - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2814 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2815 msg_advance(endcol); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2816 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2817 // Show "xxx" with the attributes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2818 if (!did_header) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2819 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2820 if (endcol == Columns - 1 && endcol <= name_col) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2821 msg_putchar(' '); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2822 msg_puts_attr("xxx", syn_id2attr(id)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2823 msg_putchar(' '); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2824 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2825 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2826 return newline; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2827 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2828 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2829 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2830 * Set the attribute numbers for a highlight group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2831 * Called after one of the attributes has changed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2832 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2833 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2834 set_hl_attr( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2835 int idx) // index in array |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2836 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2837 attrentry_T at_en; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2838 hl_group_T *sgp = HL_TABLE() + idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2839 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2840 // The "Normal" group doesn't need an attribute number |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2841 if (sgp->sg_name_u != NULL && STRCMP(sgp->sg_name_u, "NORMAL") == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2842 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2843 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2844 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2845 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2846 * For the GUI mode: If there are other than "normal" highlighting |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2847 * attributes, need to allocate an attr number. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2848 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2849 if (sgp->sg_gui_fg == INVALCOLOR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2850 && sgp->sg_gui_bg == INVALCOLOR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2851 && sgp->sg_gui_sp == INVALCOLOR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2852 && sgp->sg_font == NOFONT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2853 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2854 && sgp->sg_fontset == NOFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2855 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2856 ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2857 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2858 sgp->sg_gui_attr = sgp->sg_gui; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2859 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2860 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2861 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2862 at_en.ae_attr = sgp->sg_gui; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2863 at_en.ae_u.gui.fg_color = sgp->sg_gui_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2864 at_en.ae_u.gui.bg_color = sgp->sg_gui_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2865 at_en.ae_u.gui.sp_color = sgp->sg_gui_sp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2866 at_en.ae_u.gui.font = sgp->sg_font; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2867 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2868 at_en.ae_u.gui.fontset = sgp->sg_fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2869 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2870 sgp->sg_gui_attr = get_attr_entry(&gui_attr_table, &at_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2871 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2872 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2873 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2874 * For the term mode: If there are other than "normal" highlighting |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2875 * attributes, need to allocate an attr number. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2876 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2877 if (sgp->sg_start == NULL && sgp->sg_stop == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2878 sgp->sg_term_attr = sgp->sg_term; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2879 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2880 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2881 at_en.ae_attr = sgp->sg_term; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2882 at_en.ae_u.term.start = sgp->sg_start; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2883 at_en.ae_u.term.stop = sgp->sg_stop; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2884 sgp->sg_term_attr = get_attr_entry(&term_attr_table, &at_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2885 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2886 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2887 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2888 * For the color term mode: If there are other than "normal" |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2889 * highlighting attributes, need to allocate an attr number. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2890 */ |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2891 if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 && sgp->sg_cterm_ul == 0 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2892 # ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2893 && sgp->sg_gui_fg == INVALCOLOR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2894 && sgp->sg_gui_bg == INVALCOLOR |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2895 && sgp->sg_gui_sp == INVALCOLOR |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2896 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2897 ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2898 sgp->sg_cterm_attr = sgp->sg_cterm; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2899 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2900 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2901 at_en.ae_attr = sgp->sg_cterm; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2902 at_en.ae_u.cterm.fg_color = sgp->sg_cterm_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2903 at_en.ae_u.cterm.bg_color = sgp->sg_cterm_bg; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2904 at_en.ae_u.cterm.ul_color = sgp->sg_cterm_ul; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2905 # ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2906 # ifdef MSWIN |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2907 # ifdef VIMDLL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2908 // Only when not using the GUI. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2909 if (!gui.in_use && !gui.starting) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2910 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2911 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2912 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2913 guicolor_T fg, bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2914 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2915 id = syn_name2id((char_u *)"Normal"); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2916 if (id > 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2917 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2918 syn_id2colors(id, &fg, &bg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2919 if (sgp->sg_gui_fg == INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2920 sgp->sg_gui_fg = fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2921 if (sgp->sg_gui_bg == INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2922 sgp->sg_gui_bg = bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2923 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2924 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2925 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2926 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2927 at_en.ae_u.cterm.fg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_fg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2928 at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg); |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
2929 at_en.ae_u.cterm.ul_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_sp); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2930 if (at_en.ae_u.cterm.fg_rgb == INVALCOLOR |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2931 && at_en.ae_u.cterm.bg_rgb == INVALCOLOR) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2932 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2933 // If both fg and bg are invalid fall back to the cterm colors. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2934 // Helps when the GUI only uses an attribute, e.g. undercurl. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2935 at_en.ae_u.cterm.fg_rgb = CTERMCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2936 at_en.ae_u.cterm.bg_rgb = CTERMCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2937 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2938 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2939 sgp->sg_cterm_attr = get_attr_entry(&cterm_attr_table, &at_en); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2940 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2941 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2942 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2943 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2944 * Lookup a highlight group name and return its ID. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2945 * If it is not found, 0 is returned. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2946 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2947 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2948 syn_name2id(char_u *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2949 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2950 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2951 char_u name_u[200]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2952 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2953 // Avoid using stricmp() too much, it's slow on some systems |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2954 // Avoid alloc()/free(), these are slow too. ID names over 200 chars |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2955 // don't deserve to be found! |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2956 vim_strncpy(name_u, name, 199); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2957 vim_strup(name_u); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2958 for (i = highlight_ga.ga_len; --i >= 0; ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2959 if (HL_TABLE()[i].sg_name_u != NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2960 && STRCMP(name_u, HL_TABLE()[i].sg_name_u) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2961 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2962 return i + 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2963 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2964 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2965 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2966 * Lookup a highlight group name and return its attributes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2967 * Return zero if not found. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2968 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2969 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2970 syn_name2attr(char_u *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2971 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2972 int id = syn_name2id(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2973 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2974 if (id != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2975 return syn_id2attr(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2976 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2977 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2978 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2979 #if defined(FEAT_EVAL) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2980 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2981 * Return TRUE if highlight group "name" exists. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2982 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2983 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2984 highlight_exists(char_u *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2985 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2986 return (syn_name2id(name) > 0); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2987 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2988 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2989 # if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2990 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2991 * Return the name of highlight group "id". |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2992 * When not a valid ID return an empty string. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2993 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2994 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2995 syn_id2name(int id) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2996 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2997 if (id <= 0 || id > highlight_ga.ga_len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2998 return (char_u *)""; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2999 return HL_TABLE()[id - 1].sg_name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3000 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3001 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3002 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3003 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3004 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3005 * Like syn_name2id(), but take a pointer + length argument. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3006 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3007 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3008 syn_namen2id(char_u *linep, int len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3009 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3010 char_u *name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3011 int id = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3012 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3013 name = vim_strnsave(linep, len); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3014 if (name != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3015 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3016 id = syn_name2id(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3017 vim_free(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3018 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3019 return id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3020 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3021 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3022 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3023 * Find highlight group name in the table and return its ID. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3024 * The argument is a pointer to the name and the length of the name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3025 * If it doesn't exist yet, a new entry is created. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3026 * Return 0 for failure. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3027 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3028 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3029 syn_check_group(char_u *pp, int len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3030 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3031 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3032 char_u *name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3033 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3034 name = vim_strnsave(pp, len); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3035 if (name == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3036 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3037 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3038 id = syn_name2id(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3039 if (id == 0) // doesn't exist yet |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3040 id = syn_add_group(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3041 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3042 vim_free(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3043 return id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3044 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3045 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3046 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3047 * Add new highlight group and return its ID. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3048 * "name" must be an allocated string, it will be consumed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3049 * Return 0 for failure. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3050 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3051 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3052 syn_add_group(char_u *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3053 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3054 char_u *p; |
17797
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3055 char_u *name_up; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3056 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3057 // Check that the name is ASCII letters, digits and underscore. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3058 for (p = name; *p != NUL; ++p) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3059 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3060 if (!vim_isprintc(*p)) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3061 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3062 emsg(_("E669: Unprintable character in group name")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3063 vim_free(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3064 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3065 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3066 else if (!ASCII_ISALNUM(*p) && *p != '_') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3067 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3068 // This is an error, but since there previously was no check only |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3069 // give a warning. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3070 msg_source(HL_ATTR(HLF_W)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3071 msg(_("W18: Invalid character in group name")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3072 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3073 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3074 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3075 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3076 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3077 * First call for this growarray: init growing array. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3078 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3079 if (highlight_ga.ga_data == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3080 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3081 highlight_ga.ga_itemsize = sizeof(hl_group_T); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3082 highlight_ga.ga_growsize = 10; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3083 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3084 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3085 if (highlight_ga.ga_len >= MAX_HL_ID) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3086 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3087 emsg(_("E849: Too many highlight and syntax groups")); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3088 vim_free(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3089 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3090 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3091 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3092 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3093 * Make room for at least one other syntax_highlight entry. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3094 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3095 if (ga_grow(&highlight_ga, 1) == FAIL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3096 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3097 vim_free(name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3098 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3099 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3100 |
17797
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3101 name_up = vim_strsave_up(name); |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3102 if (name_up == NULL) |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3103 { |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3104 vim_free(name); |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3105 return 0; |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3106 } |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3107 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
3108 CLEAR_POINTER(&(HL_TABLE()[highlight_ga.ga_len])); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3109 HL_TABLE()[highlight_ga.ga_len].sg_name = name; |
17797
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3110 HL_TABLE()[highlight_ga.ga_len].sg_name_u = name_up; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3111 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3112 HL_TABLE()[highlight_ga.ga_len].sg_gui_bg = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3113 HL_TABLE()[highlight_ga.ga_len].sg_gui_fg = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3114 HL_TABLE()[highlight_ga.ga_len].sg_gui_sp = INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3115 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3116 ++highlight_ga.ga_len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3117 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3118 return highlight_ga.ga_len; // ID is index plus one |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3119 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3120 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3121 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3122 * When, just after calling syn_add_group(), an error is discovered, this |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3123 * function deletes the new name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3124 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3125 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3126 syn_unadd_group(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3127 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3128 --highlight_ga.ga_len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3129 vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3130 vim_free(HL_TABLE()[highlight_ga.ga_len].sg_name_u); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3131 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3132 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3133 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3134 * Translate a group ID to highlight attributes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3135 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3136 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3137 syn_id2attr(int hl_id) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3138 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3139 int attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3140 hl_group_T *sgp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3141 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3142 hl_id = syn_get_final_id(hl_id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3143 sgp = &HL_TABLE()[hl_id - 1]; // index is ID minus one |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3144 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3145 #ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3146 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3147 * Only use GUI attr when the GUI is being used. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3148 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3149 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3150 attr = sgp->sg_gui_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3151 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3152 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3153 if (IS_CTERM) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3154 attr = sgp->sg_cterm_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3155 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3156 attr = sgp->sg_term_attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3157 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3158 return attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3159 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3160 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3161 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3162 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3163 * Get the GUI colors and attributes for a group ID. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3164 * NOTE: the colors will be INVALCOLOR when not set, the color otherwise. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3165 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3166 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3167 syn_id2colors(int hl_id, guicolor_T *fgp, guicolor_T *bgp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3168 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3169 hl_group_T *sgp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3170 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3171 hl_id = syn_get_final_id(hl_id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3172 sgp = &HL_TABLE()[hl_id - 1]; // index is ID minus one |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3173 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3174 *fgp = sgp->sg_gui_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3175 *bgp = sgp->sg_gui_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3176 return sgp->sg_gui; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3177 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3178 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3179 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3180 #if (defined(MSWIN) \ |
19265
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
3181 && (!defined(FEAT_GUI_MSWIN) || defined(VIMDLL)) \ |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
3182 && defined(FEAT_TERMGUICOLORS)) \ |
ce8c47ed54e5
patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents:
19201
diff
changeset
|
3183 || defined(FEAT_TERMINAL) || defined(PROTO) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3184 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3185 syn_id2cterm_bg(int hl_id, int *fgp, int *bgp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3186 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3187 hl_group_T *sgp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3188 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3189 hl_id = syn_get_final_id(hl_id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3190 sgp = &HL_TABLE()[hl_id - 1]; // index is ID minus one |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3191 *fgp = sgp->sg_cterm_fg - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3192 *bgp = sgp->sg_cterm_bg - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3193 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3194 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3195 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3196 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3197 * Translate a group ID to the final group ID (following links). |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3198 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3199 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3200 syn_get_final_id(int hl_id) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3201 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3202 int count; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3203 hl_group_T *sgp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3204 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3205 if (hl_id > highlight_ga.ga_len || hl_id < 1) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3206 return 0; // Can be called from eval!! |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3207 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3208 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3209 * Follow links until there is no more. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3210 * Look out for loops! Break after 100 links. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3211 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3212 for (count = 100; --count >= 0; ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3213 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3214 sgp = &HL_TABLE()[hl_id - 1]; // index is ID minus one |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3215 if (sgp->sg_link == 0 || sgp->sg_link > highlight_ga.ga_len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3216 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3217 hl_id = sgp->sg_link; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3218 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3219 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3220 return hl_id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3221 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3222 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3223 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3224 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3225 * Call this function just after the GUI has started. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3226 * Also called when 'termguicolors' was set, gui.in_use will be FALSE then. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3227 * It finds the font and color handles for the highlighting groups. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3228 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3229 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3230 highlight_gui_started(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3231 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3232 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3233 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3234 // First get the colors from the "Normal" and "Menu" group, if set |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3235 if (USE_24BIT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3236 set_normal_colors(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3237 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3238 for (idx = 0; idx < highlight_ga.ga_len; ++idx) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3239 gui_do_one_color(idx, FALSE, FALSE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3240 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3241 highlight_changed(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3242 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3243 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3244 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3245 gui_do_one_color( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3246 int idx, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3247 int do_menu UNUSED, // TRUE: might set the menu font |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3248 int do_tooltip UNUSED) // TRUE: might set the tooltip font |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3249 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3250 int didit = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3251 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3252 # ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3253 # ifdef FEAT_TERMGUICOLORS |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3254 if (gui.in_use) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3255 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3256 if (HL_TABLE()[idx].sg_font_name != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3257 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3258 hl_do_font(idx, HL_TABLE()[idx].sg_font_name, FALSE, do_menu, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3259 do_tooltip, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3260 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3261 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3262 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3263 if (HL_TABLE()[idx].sg_gui_fg_name != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3264 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3265 HL_TABLE()[idx].sg_gui_fg = |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3266 color_name2handle(HL_TABLE()[idx].sg_gui_fg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3267 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3268 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3269 if (HL_TABLE()[idx].sg_gui_bg_name != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3270 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3271 HL_TABLE()[idx].sg_gui_bg = |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3272 color_name2handle(HL_TABLE()[idx].sg_gui_bg_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3273 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3274 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3275 if (HL_TABLE()[idx].sg_gui_sp_name != NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3276 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3277 HL_TABLE()[idx].sg_gui_sp = |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3278 color_name2handle(HL_TABLE()[idx].sg_gui_sp_name); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3279 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3280 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3281 if (didit) // need to get a new attr number |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3282 set_hl_attr(idx); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3283 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3284 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3285 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3286 #if defined(USER_HIGHLIGHT) && defined(FEAT_STL_OPT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3287 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3288 * Apply difference between User[1-9] and HLF_S to HLF_SNC, HLF_ST or HLF_STNC. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3289 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3290 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3291 combine_stl_hlt( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3292 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3293 int id_S, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3294 int id_alt, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3295 int hlcnt, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3296 int i, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3297 int hlf, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3298 int *table) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3299 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3300 hl_group_T *hlt = HL_TABLE(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3301 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3302 if (id_alt == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3303 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
3304 CLEAR_POINTER(&hlt[hlcnt + i]); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3305 hlt[hlcnt + i].sg_term = highlight_attr[hlf]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3306 hlt[hlcnt + i].sg_cterm = highlight_attr[hlf]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3307 # if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3308 hlt[hlcnt + i].sg_gui = highlight_attr[hlf]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3309 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3310 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3311 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3312 mch_memmove(&hlt[hlcnt + i], |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3313 &hlt[id_alt - 1], |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3314 sizeof(hl_group_T)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3315 hlt[hlcnt + i].sg_link = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3316 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3317 hlt[hlcnt + i].sg_term ^= |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3318 hlt[id - 1].sg_term ^ hlt[id_S - 1].sg_term; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3319 if (hlt[id - 1].sg_start != hlt[id_S - 1].sg_start) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3320 hlt[hlcnt + i].sg_start = hlt[id - 1].sg_start; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3321 if (hlt[id - 1].sg_stop != hlt[id_S - 1].sg_stop) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3322 hlt[hlcnt + i].sg_stop = hlt[id - 1].sg_stop; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3323 hlt[hlcnt + i].sg_cterm ^= |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3324 hlt[id - 1].sg_cterm ^ hlt[id_S - 1].sg_cterm; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3325 if (hlt[id - 1].sg_cterm_fg != hlt[id_S - 1].sg_cterm_fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3326 hlt[hlcnt + i].sg_cterm_fg = hlt[id - 1].sg_cterm_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3327 if (hlt[id - 1].sg_cterm_bg != hlt[id_S - 1].sg_cterm_bg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3328 hlt[hlcnt + i].sg_cterm_bg = hlt[id - 1].sg_cterm_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3329 # if defined(FEAT_GUI) || defined(FEAT_EVAL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3330 hlt[hlcnt + i].sg_gui ^= |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3331 hlt[id - 1].sg_gui ^ hlt[id_S - 1].sg_gui; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3332 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3333 # ifdef FEAT_GUI |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3334 if (hlt[id - 1].sg_gui_fg != hlt[id_S - 1].sg_gui_fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3335 hlt[hlcnt + i].sg_gui_fg = hlt[id - 1].sg_gui_fg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3336 if (hlt[id - 1].sg_gui_bg != hlt[id_S - 1].sg_gui_bg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3337 hlt[hlcnt + i].sg_gui_bg = hlt[id - 1].sg_gui_bg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3338 if (hlt[id - 1].sg_gui_sp != hlt[id_S - 1].sg_gui_sp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3339 hlt[hlcnt + i].sg_gui_sp = hlt[id - 1].sg_gui_sp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3340 if (hlt[id - 1].sg_font != hlt[id_S - 1].sg_font) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3341 hlt[hlcnt + i].sg_font = hlt[id - 1].sg_font; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3342 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3343 if (hlt[id - 1].sg_fontset != hlt[id_S - 1].sg_fontset) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3344 hlt[hlcnt + i].sg_fontset = hlt[id - 1].sg_fontset; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3345 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3346 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3347 highlight_ga.ga_len = hlcnt + i + 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3348 set_hl_attr(hlcnt + i); // At long last we can apply |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3349 table[i] = syn_id2attr(hlcnt + i + 1); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3350 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3351 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3352 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3353 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3354 * Translate the 'highlight' option into attributes in highlight_attr[] and |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3355 * set up the user highlights User1..9. If FEAT_STL_OPT is in use, a set of |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3356 * corresponding highlights to use on top of HLF_SNC is computed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3357 * Called only when the 'highlight' option has been changed and upon first |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3358 * screen redraw after any :highlight command. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3359 * Return FAIL when an invalid flag is found in 'highlight'. OK otherwise. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3360 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3361 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3362 highlight_changed(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3363 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3364 int hlf; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3365 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3366 char_u *p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3367 int attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3368 char_u *end; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3369 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3370 #ifdef USER_HIGHLIGHT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3371 char_u userhl[30]; // use 30 to avoid compiler warning |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3372 # ifdef FEAT_STL_OPT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3373 int id_S = -1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3374 int id_SNC = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3375 # ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3376 int id_ST = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3377 int id_STNC = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3378 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3379 int hlcnt; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3380 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3381 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3382 static int hl_flags[HLF_COUNT] = HL_FLAGS; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3383 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3384 need_highlight_changed = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3385 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3386 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3387 * Clear all attributes. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3388 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3389 for (hlf = 0; hlf < (int)HLF_COUNT; ++hlf) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3390 highlight_attr[hlf] = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3391 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3392 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3393 * First set all attributes to their default value. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3394 * Then use the attributes from the 'highlight' option. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3395 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3396 for (i = 0; i < 2; ++i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3397 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3398 if (i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3399 p = p_hl; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3400 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3401 p = get_highlight_default(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3402 if (p == NULL) // just in case |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3403 continue; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3404 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3405 while (*p) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3406 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3407 for (hlf = 0; hlf < (int)HLF_COUNT; ++hlf) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3408 if (hl_flags[hlf] == *p) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3409 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3410 ++p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3411 if (hlf == (int)HLF_COUNT || *p == NUL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3412 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3413 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3414 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3415 * Allow several hl_flags to be combined, like "bu" for |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3416 * bold-underlined. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3417 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3418 attr = 0; |
18806
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
3419 for ( ; *p && *p != ','; ++p) // parse up to comma |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3420 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3421 if (VIM_ISWHITE(*p)) // ignore white space |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3422 continue; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3423 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3424 if (attr > HL_ALL) // Combination with ':' is not allowed. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3425 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3426 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3427 switch (*p) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3428 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3429 case 'b': attr |= HL_BOLD; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3430 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3431 case 'i': attr |= HL_ITALIC; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3432 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3433 case '-': |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3434 case 'n': // no highlighting |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3435 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3436 case 'r': attr |= HL_INVERSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3437 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3438 case 's': attr |= HL_STANDOUT; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3439 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3440 case 'u': attr |= HL_UNDERLINE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3441 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3442 case 'c': attr |= HL_UNDERCURL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3443 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3444 case 't': attr |= HL_STRIKETHROUGH; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3445 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3446 case ':': ++p; // highlight group name |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3447 if (attr || *p == NUL) // no combinations |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3448 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3449 end = vim_strchr(p, ','); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3450 if (end == NULL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3451 end = p + STRLEN(p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3452 id = syn_check_group(p, (int)(end - p)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3453 if (id == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3454 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3455 attr = syn_id2attr(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3456 p = end - 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3457 #if defined(FEAT_STL_OPT) && defined(USER_HIGHLIGHT) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3458 if (hlf == (int)HLF_SNC) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3459 id_SNC = syn_get_final_id(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3460 # ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3461 else if (hlf == (int)HLF_ST) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3462 id_ST = syn_get_final_id(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3463 else if (hlf == (int)HLF_STNC) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3464 id_STNC = syn_get_final_id(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3465 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3466 else if (hlf == (int)HLF_S) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3467 id_S = syn_get_final_id(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3468 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3469 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3470 default: return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3471 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3472 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3473 highlight_attr[hlf] = attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3474 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3475 p = skip_to_option_part(p); // skip comma and spaces |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3476 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3477 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3478 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3479 #ifdef USER_HIGHLIGHT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3480 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3481 * Setup the user highlights |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3482 * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3483 * Temporarily utilize 28 more hl entries: |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3484 * 9 for User1-User9 combined with StatusLineNC |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3485 * 9 for User1-User9 combined with StatusLineTerm |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3486 * 9 for User1-User9 combined with StatusLineTermNC |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3487 * 1 for StatusLine default |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3488 * Have to be in there simultaneously in case of table overflows in |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3489 * get_attr_entry() |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3490 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3491 # ifdef FEAT_STL_OPT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3492 if (ga_grow(&highlight_ga, 28) == FAIL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3493 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3494 hlcnt = highlight_ga.ga_len; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3495 if (id_S == -1) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3496 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3497 // Make sure id_S is always valid to simplify code below. Use the last |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3498 // entry. |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
3499 CLEAR_POINTER(&HL_TABLE()[hlcnt + 27]); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3500 HL_TABLE()[hlcnt + 18].sg_term = highlight_attr[HLF_S]; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3501 id_S = hlcnt + 19; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3502 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3503 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3504 for (i = 0; i < 9; i++) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3505 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3506 sprintf((char *)userhl, "User%d", i + 1); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3507 id = syn_name2id(userhl); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3508 if (id == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3509 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3510 highlight_user[i] = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3511 # ifdef FEAT_STL_OPT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3512 highlight_stlnc[i] = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3513 # ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3514 highlight_stlterm[i] = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3515 highlight_stltermnc[i] = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3516 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3517 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3518 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3519 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3520 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3521 highlight_user[i] = syn_id2attr(id); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3522 # ifdef FEAT_STL_OPT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3523 combine_stl_hlt(id, id_S, id_SNC, hlcnt, i, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3524 HLF_SNC, highlight_stlnc); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3525 # ifdef FEAT_TERMINAL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3526 combine_stl_hlt(id, id_S, id_ST, hlcnt + 9, i, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3527 HLF_ST, highlight_stlterm); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3528 combine_stl_hlt(id, id_S, id_STNC, hlcnt + 18, i, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3529 HLF_STNC, highlight_stltermnc); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3530 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3531 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3532 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3533 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3534 # ifdef FEAT_STL_OPT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3535 highlight_ga.ga_len = hlcnt; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3536 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3537 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3538 #endif // USER_HIGHLIGHT |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3539 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3540 return OK; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3541 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3542 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3543 static void highlight_list(void); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3544 static void highlight_list_two(int cnt, int attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3545 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3546 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3547 * Handle command line completion for :highlight command. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3548 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3549 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3550 set_context_in_highlight_cmd(expand_T *xp, char_u *arg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3551 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3552 char_u *p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3553 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3554 // Default: expand group names |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3555 xp->xp_context = EXPAND_HIGHLIGHT; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3556 xp->xp_pattern = arg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3557 include_link = 2; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3558 include_default = 1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3559 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3560 // (part of) subcommand already typed |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3561 if (*arg != NUL) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3562 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3563 p = skiptowhite(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3564 if (*p != NUL) // past "default" or group name |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3565 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3566 include_default = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3567 if (STRNCMP("default", arg, p - arg) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3568 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3569 arg = skipwhite(p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3570 xp->xp_pattern = arg; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3571 p = skiptowhite(arg); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3572 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3573 if (*p != NUL) // past group name |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3574 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3575 include_link = 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3576 if (arg[1] == 'i' && arg[0] == 'N') |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3577 highlight_list(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3578 if (STRNCMP("link", arg, p - arg) == 0 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3579 || STRNCMP("clear", arg, p - arg) == 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3580 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3581 xp->xp_pattern = skipwhite(p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3582 p = skiptowhite(xp->xp_pattern); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3583 if (*p != NUL) // past first group name |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3584 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3585 xp->xp_pattern = skipwhite(p); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3586 p = skiptowhite(xp->xp_pattern); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3587 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3588 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3589 if (*p != NUL) // past group name(s) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3590 xp->xp_context = EXPAND_NOTHING; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3591 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3592 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3593 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3594 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3595 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3596 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3597 * List highlighting matches in a nice way. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3598 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3599 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3600 highlight_list(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3601 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3602 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3603 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3604 for (i = 10; --i >= 0; ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3605 highlight_list_two(i, HL_ATTR(HLF_D)); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3606 for (i = 40; --i >= 0; ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3607 highlight_list_two(99, 0); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3608 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3609 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3610 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3611 highlight_list_two(int cnt, int attr) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3612 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3613 msg_puts_attr(&("N \bI \b! \b"[cnt / 11]), attr); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3614 msg_clr_eos(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3615 out_flush(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3616 ui_delay(cnt == 99 ? 40L : (long)cnt * 50L, FALSE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3617 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3618 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3619 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3620 * Function given to ExpandGeneric() to obtain the list of group names. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3621 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3622 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3623 get_highlight_name(expand_T *xp UNUSED, int idx) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3624 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3625 return get_highlight_name_ext(xp, idx, TRUE); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3626 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3627 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3628 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3629 * Obtain a highlight group name. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3630 * When "skip_cleared" is TRUE don't return a cleared entry. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3631 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3632 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3633 get_highlight_name_ext(expand_T *xp UNUSED, int idx, int skip_cleared) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3634 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3635 if (idx < 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3636 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3637 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3638 // Items are never removed from the table, skip the ones that were |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3639 // cleared. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3640 if (skip_cleared && idx < highlight_ga.ga_len && HL_TABLE()[idx].sg_cleared) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3641 return (char_u *)""; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3642 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3643 if (idx == highlight_ga.ga_len && include_none != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3644 return (char_u *)"none"; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3645 if (idx == highlight_ga.ga_len + include_none && include_default != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3646 return (char_u *)"default"; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3647 if (idx == highlight_ga.ga_len + include_none + include_default |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3648 && include_link != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3649 return (char_u *)"link"; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3650 if (idx == highlight_ga.ga_len + include_none + include_default + 1 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3651 && include_link != 0) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3652 return (char_u *)"clear"; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3653 if (idx >= highlight_ga.ga_len) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3654 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3655 return HL_TABLE()[idx].sg_name; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3656 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3657 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3658 #if defined(FEAT_GUI) || defined(PROTO) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3659 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3660 * Free all the highlight group fonts. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3661 * Used when quitting for systems which need it. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3662 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3663 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3664 free_highlight_fonts(void) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3665 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3666 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3667 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3668 for (idx = 0; idx < highlight_ga.ga_len; ++idx) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3669 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3670 gui_mch_free_font(HL_TABLE()[idx].sg_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3671 HL_TABLE()[idx].sg_font = NOFONT; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3672 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3673 gui_mch_free_fontset(HL_TABLE()[idx].sg_fontset); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3674 HL_TABLE()[idx].sg_fontset = NOFONTSET; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3675 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3676 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3677 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3678 gui_mch_free_font(gui.norm_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3679 # ifdef FEAT_XFONTSET |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3680 gui_mch_free_fontset(gui.fontset); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3681 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3682 # ifndef FEAT_GUI_GTK |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3683 gui_mch_free_font(gui.bold_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3684 gui_mch_free_font(gui.ital_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3685 gui_mch_free_font(gui.boldital_font); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3686 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3687 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3688 #endif |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3689 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3690 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3691 #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3692 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3693 # define SEARCH_HL_PRIORITY 0 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3694 |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3695 /* |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3696 * Add match to the match list of window 'wp'. The pattern 'pat' will be |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3697 * highlighted with the group 'grp' with priority 'prio'. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3698 * Optionally, a desired ID 'id' can be specified (greater than or equal to 1). |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3699 * If no particular ID is desired, -1 must be specified for 'id'. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3700 * Return ID of added match, -1 on failure. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3701 */ |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
3702 static int |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3703 match_add( |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3704 win_T *wp, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3705 char_u *grp, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3706 char_u *pat, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3707 int prio, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3708 int id, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3709 list_T *pos_list, |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3710 char_u *conceal_char UNUSED) // pointer to conceal replacement char |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3711 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3712 matchitem_T *cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3713 matchitem_T *prev; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3714 matchitem_T *m; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3715 int hlg_id; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3716 regprog_T *regprog = NULL; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3717 int rtype = SOME_VALID; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3718 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3719 if (*grp == NUL || (pat != NULL && *pat == NUL)) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3720 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3721 if (id < -1 || id == 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3722 { |
18498
9e6d5a4abb1c
patch 8.1.2243: typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
18301
diff
changeset
|
3723 semsg(_("E799: Invalid ID: %d (must be greater than or equal to 1)"), |
9e6d5a4abb1c
patch 8.1.2243: typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
18301
diff
changeset
|
3724 id); |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3725 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3726 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3727 if (id != -1) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3728 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3729 cur = wp->w_match_head; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3730 while (cur != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3731 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3732 if (cur->id == id) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3733 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3734 semsg(_("E801: ID already taken: %d"), id); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3735 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3736 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3737 cur = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3738 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3739 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3740 if ((hlg_id = syn_namen2id(grp, (int)STRLEN(grp))) == 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3741 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3742 semsg(_(e_nogroup), grp); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3743 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3744 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3745 if (pat != NULL && (regprog = vim_regcomp(pat, RE_MAGIC)) == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3746 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3747 semsg(_(e_invarg2), pat); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3748 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3749 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3750 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3751 // Find available match ID. |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3752 while (id == -1) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3753 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3754 cur = wp->w_match_head; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3755 while (cur != NULL && cur->id != wp->w_next_match_id) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3756 cur = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3757 if (cur == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3758 id = wp->w_next_match_id; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3759 wp->w_next_match_id++; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3760 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3761 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3762 // Build new match. |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3763 m = ALLOC_CLEAR_ONE(matchitem_T); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3764 m->id = id; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3765 m->priority = prio; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3766 m->pattern = pat == NULL ? NULL : vim_strsave(pat); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3767 m->hlg_id = hlg_id; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3768 m->match.regprog = regprog; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3769 m->match.rmm_ic = FALSE; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3770 m->match.rmm_maxcol = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3771 # if defined(FEAT_CONCEAL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3772 m->conceal_char = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3773 if (conceal_char != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3774 m->conceal_char = (*mb_ptr2char)(conceal_char); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3775 # endif |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3776 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3777 // Set up position matches |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3778 if (pos_list != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3779 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3780 linenr_T toplnum = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3781 linenr_T botlnum = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3782 listitem_T *li; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3783 int i; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3784 |
20392
4c317d8c1051
patch 8.2.0751: Vim9: performance can be improved
Bram Moolenaar <Bram@vim.org>
parents:
20160
diff
changeset
|
3785 CHECK_LIST_MATERIALIZE(pos_list); |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3786 for (i = 0, li = pos_list->lv_first; li != NULL && i < MAXPOSMATCH; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3787 i++, li = li->li_next) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3788 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3789 linenr_T lnum = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3790 colnr_T col = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3791 int len = 1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3792 list_T *subl; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3793 listitem_T *subli; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3794 int error = FALSE; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3795 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3796 if (li->li_tv.v_type == VAR_LIST) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3797 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3798 subl = li->li_tv.vval.v_list; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3799 if (subl == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3800 goto fail; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3801 subli = subl->lv_first; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3802 if (subli == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3803 goto fail; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3804 lnum = tv_get_number_chk(&subli->li_tv, &error); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3805 if (error == TRUE) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3806 goto fail; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3807 if (lnum == 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3808 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3809 --i; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3810 continue; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3811 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3812 m->pos.pos[i].lnum = lnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3813 subli = subli->li_next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3814 if (subli != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3815 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3816 col = tv_get_number_chk(&subli->li_tv, &error); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3817 if (error == TRUE) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3818 goto fail; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3819 subli = subli->li_next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3820 if (subli != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3821 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3822 len = tv_get_number_chk(&subli->li_tv, &error); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3823 if (error == TRUE) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3824 goto fail; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3825 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3826 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3827 m->pos.pos[i].col = col; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3828 m->pos.pos[i].len = len; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3829 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3830 else if (li->li_tv.v_type == VAR_NUMBER) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3831 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3832 if (li->li_tv.vval.v_number == 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3833 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3834 --i; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3835 continue; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3836 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3837 m->pos.pos[i].lnum = li->li_tv.vval.v_number; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3838 m->pos.pos[i].col = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3839 m->pos.pos[i].len = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3840 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3841 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3842 { |
18953
30c965c6f855
patch 8.2.0037: missing renamed message
Bram Moolenaar <Bram@vim.org>
parents:
18949
diff
changeset
|
3843 emsg(_("E290: List or number required")); |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3844 goto fail; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3845 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3846 if (toplnum == 0 || lnum < toplnum) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3847 toplnum = lnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3848 if (botlnum == 0 || lnum >= botlnum) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3849 botlnum = lnum + 1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3850 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3851 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3852 // Calculate top and bottom lines for redrawing area |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3853 if (toplnum != 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3854 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3855 if (wp->w_buffer->b_mod_set) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3856 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3857 if (wp->w_buffer->b_mod_top > toplnum) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3858 wp->w_buffer->b_mod_top = toplnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3859 if (wp->w_buffer->b_mod_bot < botlnum) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3860 wp->w_buffer->b_mod_bot = botlnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3861 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3862 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3863 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3864 wp->w_buffer->b_mod_set = TRUE; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3865 wp->w_buffer->b_mod_top = toplnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3866 wp->w_buffer->b_mod_bot = botlnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3867 wp->w_buffer->b_mod_xlines = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3868 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3869 m->pos.toplnum = toplnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3870 m->pos.botlnum = botlnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3871 rtype = VALID; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3872 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3873 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3874 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3875 // Insert new match. The match list is in ascending order with regard to |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3876 // the match priorities. |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3877 cur = wp->w_match_head; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3878 prev = cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3879 while (cur != NULL && prio >= cur->priority) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3880 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3881 prev = cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3882 cur = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3883 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3884 if (cur == prev) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3885 wp->w_match_head = m; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3886 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3887 prev->next = m; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3888 m->next = cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3889 |
17486
bdf277d2d14c
patch 8.1.1741: cleared/added match highlighting not updated in other window
Bram Moolenaar <Bram@vim.org>
parents:
17482
diff
changeset
|
3890 redraw_win_later(wp, rtype); |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3891 return id; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3892 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3893 fail: |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3894 vim_free(m); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3895 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3896 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3897 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3898 /* |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3899 * Delete match with ID 'id' in the match list of window 'wp'. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3900 * Print error messages if 'perr' is TRUE. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3901 */ |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
3902 static int |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3903 match_delete(win_T *wp, int id, int perr) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3904 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3905 matchitem_T *cur = wp->w_match_head; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3906 matchitem_T *prev = cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3907 int rtype = SOME_VALID; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3908 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3909 if (id < 1) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3910 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3911 if (perr == TRUE) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3912 semsg(_("E802: Invalid ID: %d (must be greater than or equal to 1)"), |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3913 id); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3914 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3915 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3916 while (cur != NULL && cur->id != id) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3917 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3918 prev = cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3919 cur = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3920 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3921 if (cur == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3922 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3923 if (perr == TRUE) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3924 semsg(_("E803: ID not found: %d"), id); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3925 return -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3926 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3927 if (cur == prev) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3928 wp->w_match_head = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3929 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3930 prev->next = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3931 vim_regfree(cur->match.regprog); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3932 vim_free(cur->pattern); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3933 if (cur->pos.toplnum != 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3934 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3935 if (wp->w_buffer->b_mod_set) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3936 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3937 if (wp->w_buffer->b_mod_top > cur->pos.toplnum) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3938 wp->w_buffer->b_mod_top = cur->pos.toplnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3939 if (wp->w_buffer->b_mod_bot < cur->pos.botlnum) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3940 wp->w_buffer->b_mod_bot = cur->pos.botlnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3941 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3942 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3943 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3944 wp->w_buffer->b_mod_set = TRUE; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3945 wp->w_buffer->b_mod_top = cur->pos.toplnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3946 wp->w_buffer->b_mod_bot = cur->pos.botlnum; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3947 wp->w_buffer->b_mod_xlines = 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3948 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3949 rtype = VALID; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3950 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3951 vim_free(cur); |
17482
6cf077f59152
patch 8.1.1739: deleted match highlighting not updated in other window
Bram Moolenaar <Bram@vim.org>
parents:
17474
diff
changeset
|
3952 redraw_win_later(wp, rtype); |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3953 return 0; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3954 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3955 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3956 /* |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3957 * Delete all matches in the match list of window 'wp'. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3958 */ |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3959 void |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3960 clear_matches(win_T *wp) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3961 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3962 matchitem_T *m; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3963 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3964 while (wp->w_match_head != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3965 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3966 m = wp->w_match_head->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3967 vim_regfree(wp->w_match_head->match.regprog); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3968 vim_free(wp->w_match_head->pattern); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3969 vim_free(wp->w_match_head); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3970 wp->w_match_head = m; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3971 } |
17486
bdf277d2d14c
patch 8.1.1741: cleared/added match highlighting not updated in other window
Bram Moolenaar <Bram@vim.org>
parents:
17482
diff
changeset
|
3972 redraw_win_later(wp, SOME_VALID); |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3973 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3974 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3975 /* |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3976 * Get match from ID 'id' in window 'wp'. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3977 * Return NULL if match not found. |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3978 */ |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
3979 static matchitem_T * |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3980 get_match(win_T *wp, int id) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3981 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3982 matchitem_T *cur = wp->w_match_head; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3983 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3984 while (cur != NULL && cur->id != id) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3985 cur = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3986 return cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
3987 } |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3988 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3989 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3990 * Init for calling prepare_search_hl(). |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3991 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3992 void |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3993 init_search_hl(win_T *wp, match_T *search_hl) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3994 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3995 matchitem_T *cur; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3996 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3997 // Setup for match and 'hlsearch' highlighting. Disable any previous |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
3998 // match |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
3999 cur = wp->w_match_head; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4000 while (cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4001 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4002 cur->hl.rm = cur->match; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4003 if (cur->hlg_id == 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4004 cur->hl.attr = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4005 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4006 cur->hl.attr = syn_id2attr(cur->hlg_id); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4007 cur->hl.buf = wp->w_buffer; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4008 cur->hl.lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4009 cur->hl.first_lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4010 # ifdef FEAT_RELTIME |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4011 // Set the time limit to 'redrawtime'. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4012 profile_setlimit(p_rdt, &(cur->hl.tm)); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4013 # endif |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4014 cur = cur->next; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4015 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4016 search_hl->buf = wp->w_buffer; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4017 search_hl->lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4018 search_hl->first_lnum = 0; |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4019 // time limit is set at the toplevel, for all windows |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4020 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4021 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4022 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4023 * If there is a match fill "shl" and return one. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4024 * Return zero otherwise. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4025 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4026 static int |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4027 next_search_hl_pos( |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4028 match_T *shl, // points to a match |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4029 linenr_T lnum, |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4030 posmatch_T *posmatch, // match positions |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4031 colnr_T mincol) // minimal column for a match |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4032 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4033 int i; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4034 int found = -1; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4035 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4036 for (i = posmatch->cur; i < MAXPOSMATCH; i++) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4037 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4038 llpos_T *pos = &posmatch->pos[i]; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4039 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4040 if (pos->lnum == 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4041 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4042 if (pos->len == 0 && pos->col < mincol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4043 continue; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4044 if (pos->lnum == lnum) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4045 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4046 if (found >= 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4047 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4048 // if this match comes before the one at "found" then swap |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4049 // them |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4050 if (pos->col < posmatch->pos[found].col) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4051 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4052 llpos_T tmp = *pos; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4053 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4054 *pos = posmatch->pos[found]; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4055 posmatch->pos[found] = tmp; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4056 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4057 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4058 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4059 found = i; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4060 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4061 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4062 posmatch->cur = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4063 if (found >= 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4064 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4065 colnr_T start = posmatch->pos[found].col == 0 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4066 ? 0 : posmatch->pos[found].col - 1; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4067 colnr_T end = posmatch->pos[found].col == 0 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4068 ? MAXCOL : start + posmatch->pos[found].len; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4069 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4070 shl->lnum = lnum; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4071 shl->rm.startpos[0].lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4072 shl->rm.startpos[0].col = start; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4073 shl->rm.endpos[0].lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4074 shl->rm.endpos[0].col = end; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4075 shl->is_addpos = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4076 posmatch->cur = found + 1; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4077 return 1; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4078 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4079 return 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4080 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4081 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4082 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4083 * Search for a next 'hlsearch' or match. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4084 * Uses shl->buf. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4085 * Sets shl->lnum and shl->rm contents. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4086 * Note: Assumes a previous match is always before "lnum", unless |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4087 * shl->lnum is zero. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4088 * Careful: Any pointers for buffer lines will become invalid. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4089 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4090 static void |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4091 next_search_hl( |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4092 win_T *win, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4093 match_T *search_hl, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4094 match_T *shl, // points to search_hl or a match |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4095 linenr_T lnum, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4096 colnr_T mincol, // minimal column for a match |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4097 matchitem_T *cur) // to retrieve match positions if any |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4098 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4099 linenr_T l; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4100 colnr_T matchcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4101 long nmatched; |
18949
5c405689da3e
patch 8.2.0035: saving and restoring called_emsg is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
18806
diff
changeset
|
4102 int called_emsg_before = called_emsg; |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4103 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4104 // for :{range}s/pat only highlight inside the range |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4105 if (lnum < search_first_line || lnum > search_last_line) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4106 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4107 shl->lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4108 return; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4109 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4110 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4111 if (shl->lnum != 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4112 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4113 // Check for three situations: |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4114 // 1. If the "lnum" is below a previous match, start a new search. |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4115 // 2. If the previous match includes "mincol", use it. |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4116 // 3. Continue after the previous match. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4117 l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4118 if (lnum > l) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4119 shl->lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4120 else if (lnum < l || shl->rm.endpos[0].col > mincol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4121 return; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4122 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4123 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4124 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4125 * Repeat searching for a match until one is found that includes "mincol" |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4126 * or none is found in this line. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4127 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4128 for (;;) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4129 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4130 # ifdef FEAT_RELTIME |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4131 // Stop searching after passing the time limit. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4132 if (profile_passed_limit(&(shl->tm))) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4133 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4134 shl->lnum = 0; // no match found in time |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4135 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4136 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4137 # endif |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4138 // Three situations: |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4139 // 1. No useful previous match: search from start of line. |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4140 // 2. Not Vi compatible or empty match: continue at next character. |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4141 // Break the loop if this is beyond the end of the line. |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4142 // 3. Vi compatible searching: continue at end of previous match. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4143 if (shl->lnum == 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4144 matchcol = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4145 else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4146 || (shl->rm.endpos[0].lnum == 0 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4147 && shl->rm.endpos[0].col <= shl->rm.startpos[0].col)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4148 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4149 char_u *ml; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4150 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4151 matchcol = shl->rm.startpos[0].col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4152 ml = ml_get_buf(shl->buf, lnum, FALSE) + matchcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4153 if (*ml == NUL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4154 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4155 ++matchcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4156 shl->lnum = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4157 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4158 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4159 if (has_mbyte) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4160 matchcol += mb_ptr2len(ml); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4161 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4162 ++matchcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4163 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4164 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4165 matchcol = shl->rm.endpos[0].col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4166 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4167 shl->lnum = lnum; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4168 if (shl->rm.regprog != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4169 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4170 // Remember whether shl->rm is using a copy of the regprog in |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4171 // cur->match. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4172 int regprog_is_copy = (shl != search_hl && cur != NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4173 && shl == &cur->hl |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4174 && cur->match.regprog == cur->hl.rm.regprog); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4175 int timed_out = FALSE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4176 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4177 nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4178 matchcol, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4179 #ifdef FEAT_RELTIME |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4180 &(shl->tm), &timed_out |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4181 #else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4182 NULL, NULL |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4183 #endif |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4184 ); |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4185 // Copy the regprog, in case it got freed and recompiled. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4186 if (regprog_is_copy) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4187 cur->match.regprog = cur->hl.rm.regprog; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4188 |
18949
5c405689da3e
patch 8.2.0035: saving and restoring called_emsg is clumsy
Bram Moolenaar <Bram@vim.org>
parents:
18806
diff
changeset
|
4189 if (called_emsg > called_emsg_before || got_int || timed_out) |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4190 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4191 // Error while handling regexp: stop using this regexp. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4192 if (shl == search_hl) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4193 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4194 // don't free regprog in the match list, it's a copy |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4195 vim_regfree(shl->rm.regprog); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4196 set_no_hlsearch(TRUE); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4197 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4198 shl->rm.regprog = NULL; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4199 shl->lnum = 0; |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4200 got_int = FALSE; // avoid the "Type :quit to exit Vim" message |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4201 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4202 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4203 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4204 else if (cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4205 nmatched = next_search_hl_pos(shl, lnum, &(cur->pos), matchcol); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4206 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4207 nmatched = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4208 if (nmatched == 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4209 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4210 shl->lnum = 0; // no match found |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4211 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4212 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4213 if (shl->rm.startpos[0].lnum > 0 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4214 || shl->rm.startpos[0].col >= mincol |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4215 || nmatched > 1 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4216 || shl->rm.endpos[0].col > mincol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4217 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4218 shl->lnum += shl->rm.startpos[0].lnum; |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4219 break; // useful match found |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4220 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4221 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4222 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4223 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4224 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4225 * Advance to the match in window "wp" line "lnum" or past it. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4226 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4227 void |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4228 prepare_search_hl(win_T *wp, match_T *search_hl, linenr_T lnum) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4229 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4230 matchitem_T *cur; // points to the match list |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4231 match_T *shl; // points to search_hl or a match |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4232 int shl_flag; // flag to indicate whether search_hl |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4233 // has been processed or not |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4234 int pos_inprogress; // marks that position match search is |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4235 // in progress |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4236 int n; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4237 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4238 // When using a multi-line pattern, start searching at the top |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4239 // of the window or just after a closed fold. |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4240 // Do this both for search_hl and the match list. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4241 cur = wp->w_match_head; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4242 shl_flag = WIN_IS_POPUP(wp); // skip search_hl in a popup window |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4243 while (cur != NULL || shl_flag == FALSE) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4244 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4245 if (shl_flag == FALSE) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4246 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4247 shl = search_hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4248 shl_flag = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4249 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4250 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4251 shl = &cur->hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4252 if (shl->rm.regprog != NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4253 && shl->lnum == 0 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4254 && re_multiline(shl->rm.regprog)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4255 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4256 if (shl->first_lnum == 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4257 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4258 # ifdef FEAT_FOLDING |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4259 for (shl->first_lnum = lnum; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4260 shl->first_lnum > wp->w_topline; --shl->first_lnum) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4261 if (hasFoldingWin(wp, shl->first_lnum - 1, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4262 NULL, NULL, TRUE, NULL)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4263 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4264 # else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4265 shl->first_lnum = wp->w_topline; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4266 # endif |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4267 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4268 if (cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4269 cur->pos.cur = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4270 pos_inprogress = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4271 n = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4272 while (shl->first_lnum < lnum && (shl->rm.regprog != NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4273 || (cur != NULL && pos_inprogress))) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4274 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4275 next_search_hl(wp, search_hl, shl, shl->first_lnum, (colnr_T)n, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4276 shl == search_hl ? NULL : cur); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4277 pos_inprogress = cur == NULL || cur->pos.cur == 0 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4278 ? FALSE : TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4279 if (shl->lnum != 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4280 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4281 shl->first_lnum = shl->lnum |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4282 + shl->rm.endpos[0].lnum |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4283 - shl->rm.startpos[0].lnum; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4284 n = shl->rm.endpos[0].col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4285 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4286 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4287 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4288 ++shl->first_lnum; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4289 n = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4290 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4291 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4292 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4293 if (shl != search_hl && cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4294 cur = cur->next; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4295 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4296 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4297 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4298 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4299 * Prepare for 'hlsearch' and match highlighting in one window line. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4300 * Return TRUE if there is such highlighting and set "search_attr" to the |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4301 * current highlight attribute. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4302 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4303 int |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4304 prepare_search_hl_line( |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4305 win_T *wp, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4306 linenr_T lnum, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4307 colnr_T mincol, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4308 char_u **line, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4309 match_T *search_hl, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4310 int *search_attr) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4311 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4312 matchitem_T *cur; // points to the match list |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4313 match_T *shl; // points to search_hl or a match |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4314 int shl_flag; // flag to indicate whether search_hl |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4315 // has been processed or not |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4316 int area_highlighting = FALSE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4317 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4318 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4319 * Handle highlighting the last used search pattern and matches. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4320 * Do this for both search_hl and the match list. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4321 * Do not use search_hl in a popup window. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4322 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4323 cur = wp->w_match_head; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4324 shl_flag = WIN_IS_POPUP(wp); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4325 while (cur != NULL || shl_flag == FALSE) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4326 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4327 if (shl_flag == FALSE) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4328 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4329 shl = search_hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4330 shl_flag = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4331 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4332 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4333 shl = &cur->hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4334 shl->startcol = MAXCOL; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4335 shl->endcol = MAXCOL; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4336 shl->attr_cur = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4337 shl->is_addpos = FALSE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4338 if (cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4339 cur->pos.cur = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4340 next_search_hl(wp, search_hl, shl, lnum, mincol, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4341 shl == search_hl ? NULL : cur); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4342 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4343 // Need to get the line again, a multi-line regexp may have made it |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4344 // invalid. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4345 *line = ml_get_buf(wp->w_buffer, lnum, FALSE); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4346 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4347 if (shl->lnum != 0 && shl->lnum <= lnum) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4348 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4349 if (shl->lnum == lnum) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4350 shl->startcol = shl->rm.startpos[0].col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4351 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4352 shl->startcol = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4353 if (lnum == shl->lnum + shl->rm.endpos[0].lnum |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4354 - shl->rm.startpos[0].lnum) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4355 shl->endcol = shl->rm.endpos[0].col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4356 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4357 shl->endcol = MAXCOL; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4358 // Highlight one character for an empty match. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4359 if (shl->startcol == shl->endcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4360 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4361 if (has_mbyte && (*line)[shl->endcol] != NUL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4362 shl->endcol += (*mb_ptr2len)((*line) + shl->endcol); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4363 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4364 ++shl->endcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4365 } |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4366 if ((long)shl->startcol < mincol) // match at leftcol |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4367 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4368 shl->attr_cur = shl->attr; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4369 *search_attr = shl->attr; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4370 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4371 area_highlighting = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4372 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4373 if (shl != search_hl && cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4374 cur = cur->next; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4375 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4376 return area_highlighting; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4377 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4378 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4379 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4380 * For a position in a line: Check for start/end of 'hlsearch' and other |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4381 * matches. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4382 * After end, check for start/end of next match. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4383 * When another match, have to check for start again. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4384 * Watch out for matching an empty string! |
18498
9e6d5a4abb1c
patch 8.1.2243: typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
18301
diff
changeset
|
4385 * Return the updated search_attr. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4386 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4387 int |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4388 update_search_hl( |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4389 win_T *wp, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4390 linenr_T lnum, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4391 colnr_T col, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4392 char_u **line, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4393 match_T *search_hl, |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4394 int *has_match_conc UNUSED, |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4395 int *match_conc UNUSED, |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4396 int did_line_attr, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4397 int lcs_eol_one) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4398 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4399 matchitem_T *cur; // points to the match list |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4400 match_T *shl; // points to search_hl or a match |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4401 int shl_flag; // flag to indicate whether search_hl |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4402 // has been processed or not |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4403 int pos_inprogress; // marks that position match search is in |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4404 // progress |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4405 int search_attr = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4406 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4407 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4408 // Do this for 'search_hl' and the match list (ordered by priority). |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4409 cur = wp->w_match_head; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4410 shl_flag = WIN_IS_POPUP(wp); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4411 while (cur != NULL || shl_flag == FALSE) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4412 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4413 if (shl_flag == FALSE |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4414 && ((cur != NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4415 && cur->priority > SEARCH_HL_PRIORITY) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4416 || cur == NULL)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4417 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4418 shl = search_hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4419 shl_flag = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4420 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4421 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4422 shl = &cur->hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4423 if (cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4424 cur->pos.cur = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4425 pos_inprogress = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4426 while (shl->rm.regprog != NULL || (cur != NULL && pos_inprogress)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4427 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4428 if (shl->startcol != MAXCOL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4429 && col >= shl->startcol |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4430 && col < shl->endcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4431 { |
18251
c8a53c0daeed
patch 8.1.2120: some MB_ macros are more complicated than necessary
Bram Moolenaar <Bram@vim.org>
parents:
18068
diff
changeset
|
4432 int next_col = col + mb_ptr2len(*line + col); |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4433 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4434 if (shl->endcol < next_col) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4435 shl->endcol = next_col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4436 shl->attr_cur = shl->attr; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4437 # ifdef FEAT_CONCEAL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4438 // Match with the "Conceal" group results in hiding |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4439 // the match. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4440 if (cur != NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4441 && shl != search_hl |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4442 && syn_name2id((char_u *)"Conceal") == cur->hlg_id) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4443 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4444 *has_match_conc = col == shl->startcol ? 2 : 1; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4445 *match_conc = cur->conceal_char; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4446 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4447 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4448 *has_match_conc = *match_conc = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4449 # endif |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4450 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4451 else if (col == shl->endcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4452 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4453 shl->attr_cur = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4454 next_search_hl(wp, search_hl, shl, lnum, col, |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4455 shl == search_hl ? NULL : cur); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4456 pos_inprogress = !(cur == NULL || cur->pos.cur == 0); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4457 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4458 // Need to get the line again, a multi-line regexp may have |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4459 // made it invalid. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4460 *line = ml_get_buf(wp->w_buffer, lnum, FALSE); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4461 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4462 if (shl->lnum == lnum) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4463 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4464 shl->startcol = shl->rm.startpos[0].col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4465 if (shl->rm.endpos[0].lnum == 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4466 shl->endcol = shl->rm.endpos[0].col; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4467 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4468 shl->endcol = MAXCOL; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4469 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4470 if (shl->startcol == shl->endcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4471 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4472 // highlight empty match, try again after |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4473 // it |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4474 if (has_mbyte) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4475 shl->endcol += (*mb_ptr2len)(*line + shl->endcol); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4476 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4477 ++shl->endcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4478 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4479 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4480 // Loop to check if the match starts at the |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4481 // current position |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4482 continue; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4483 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4484 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4485 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4486 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4487 if (shl != search_hl && cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4488 cur = cur->next; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4489 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4490 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4491 // Use attributes from match with highest priority among 'search_hl' and |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4492 // the match list. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4493 cur = wp->w_match_head; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4494 shl_flag = WIN_IS_POPUP(wp); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4495 while (cur != NULL || shl_flag == FALSE) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4496 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4497 if (shl_flag == FALSE |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4498 && ((cur != NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4499 && cur->priority > SEARCH_HL_PRIORITY) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4500 || cur == NULL)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4501 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4502 shl = search_hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4503 shl_flag = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4504 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4505 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4506 shl = &cur->hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4507 if (shl->attr_cur != 0) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4508 search_attr = shl->attr_cur; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4509 if (shl != search_hl && cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4510 cur = cur->next; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4511 } |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4512 // Only highlight one character after the last column. |
17490
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4513 if (*(*line + col) == NUL && (did_line_attr >= 1 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4514 || (wp->w_p_list && lcs_eol_one == -1))) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4515 search_attr = 0; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4516 return search_attr; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4517 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4518 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4519 int |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4520 get_prevcol_hl_flag(win_T *wp, match_T *search_hl, long curcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4521 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4522 long prevcol = curcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4523 int prevcol_hl_flag = FALSE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4524 matchitem_T *cur; // points to the match list |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4525 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4526 // we're not really at that column when skipping some text |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4527 if ((long)(wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4528 ++prevcol; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4529 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4530 if (!search_hl->is_addpos && prevcol == (long)search_hl->startcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4531 prevcol_hl_flag = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4532 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4533 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4534 cur = wp->w_match_head; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4535 while (cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4536 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4537 if (!cur->hl.is_addpos && prevcol == (long)cur->hl.startcol) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4538 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4539 prevcol_hl_flag = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4540 break; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4541 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4542 cur = cur->next; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4543 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4544 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4545 return prevcol_hl_flag; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4546 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4547 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4548 /* |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4549 * Get highlighting for the char after the text in "char_attr" from 'hlsearch' |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4550 * or match highlighting. |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4551 */ |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4552 void |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4553 get_search_match_hl(win_T *wp, match_T *search_hl, long col, int *char_attr) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4554 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4555 matchitem_T *cur; // points to the match list |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4556 match_T *shl; // points to search_hl or a match |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4557 int shl_flag; // flag to indicate whether search_hl |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4558 // has been processed or not |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4559 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4560 cur = wp->w_match_head; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4561 shl_flag = WIN_IS_POPUP(wp); |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4562 while (cur != NULL || shl_flag == FALSE) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4563 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4564 if (shl_flag == FALSE |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4565 && ((cur != NULL |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4566 && cur->priority > SEARCH_HL_PRIORITY) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4567 || cur == NULL)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4568 { |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4569 shl = search_hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4570 shl_flag = TRUE; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4571 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4572 else |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4573 shl = &cur->hl; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4574 if (col - 1 == (long)shl->startcol |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4575 && (shl == search_hl || !shl->is_addpos)) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4576 *char_attr = shl->attr; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4577 if (shl != search_hl && cur != NULL) |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4578 cur = cur->next; |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4579 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4580 } |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4581 |
367ef00c6258
patch 8.1.1743: 'hlsearch' and match highlighting in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
17488
diff
changeset
|
4582 #endif // FEAT_SEARCH_EXTRA |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4583 |
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4584 #if defined(FEAT_EVAL) || defined(PROTO) |
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4585 # ifdef FEAT_SEARCH_EXTRA |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4586 static int |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4587 matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4588 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4589 dictitem_T *di; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4590 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4591 if (tv->v_type != VAR_DICT) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4592 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4593 emsg(_(e_dictreq)); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4594 return FAIL; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4595 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4596 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4597 if (dict_find(tv->vval.v_dict, (char_u *)"conceal", -1) != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4598 *conceal_char = dict_get_string(tv->vval.v_dict, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4599 (char_u *)"conceal", FALSE); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4600 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4601 if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4602 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4603 *win = find_win_by_nr_or_id(&di->di_tv); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4604 if (*win == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4605 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4606 emsg(_(e_invalwindow)); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4607 return FAIL; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4608 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4609 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4610 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4611 return OK; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4612 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4613 #endif |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4614 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4615 /* |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4616 * "clearmatches()" function |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4617 */ |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4618 void |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4619 f_clearmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4620 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4621 #ifdef FEAT_SEARCH_EXTRA |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4622 win_T *win = get_optional_window(argvars, 0); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4623 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4624 if (win != NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4625 clear_matches(win); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4626 #endif |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4627 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4628 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4629 /* |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4630 * "getmatches()" function |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4631 */ |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4632 void |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4633 f_getmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4634 { |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4635 # ifdef FEAT_SEARCH_EXTRA |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4636 dict_T *dict; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4637 matchitem_T *cur; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4638 int i; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4639 win_T *win = get_optional_window(argvars, 0); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4640 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4641 if (rettv_list_alloc(rettv) == FAIL || win == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4642 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4643 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4644 cur = win->w_match_head; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4645 while (cur != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4646 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4647 dict = dict_alloc(); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4648 if (dict == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4649 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4650 if (cur->match.regprog == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4651 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4652 // match added with matchaddpos() |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4653 for (i = 0; i < MAXPOSMATCH; ++i) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4654 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4655 llpos_T *llpos; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4656 char buf[30]; // use 30 to avoid compiler warning |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4657 list_T *l; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4658 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4659 llpos = &cur->pos.pos[i]; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4660 if (llpos->lnum == 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4661 break; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4662 l = list_alloc(); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4663 if (l == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4664 break; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4665 list_append_number(l, (varnumber_T)llpos->lnum); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4666 if (llpos->col > 0) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4667 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4668 list_append_number(l, (varnumber_T)llpos->col); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4669 list_append_number(l, (varnumber_T)llpos->len); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4670 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4671 sprintf(buf, "pos%d", i + 1); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4672 dict_add_list(dict, buf, l); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4673 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4674 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4675 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4676 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4677 dict_add_string(dict, "pattern", cur->pattern); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4678 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4679 dict_add_string(dict, "group", syn_id2name(cur->hlg_id)); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4680 dict_add_number(dict, "priority", (long)cur->priority); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4681 dict_add_number(dict, "id", (long)cur->id); |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4682 # if defined(FEAT_CONCEAL) |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4683 if (cur->conceal_char) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4684 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4685 char_u buf[MB_MAXBYTES + 1]; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4686 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4687 buf[(*mb_char2bytes)((int)cur->conceal_char, buf)] = NUL; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4688 dict_add_string(dict, "conceal", (char_u *)&buf); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4689 } |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4690 # endif |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4691 list_append_dict(rettv->vval.v_list, dict); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4692 cur = cur->next; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4693 } |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4694 # endif |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4695 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4696 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4697 /* |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4698 * "setmatches()" function |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4699 */ |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4700 void |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4701 f_setmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4702 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4703 #ifdef FEAT_SEARCH_EXTRA |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4704 list_T *l; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4705 listitem_T *li; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4706 dict_T *d; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4707 list_T *s = NULL; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4708 win_T *win = get_optional_window(argvars, 1); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4709 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4710 rettv->vval.v_number = -1; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4711 if (argvars[0].v_type != VAR_LIST) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4712 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4713 emsg(_(e_listreq)); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4714 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4715 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4716 if (win == NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4717 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4718 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4719 if ((l = argvars[0].vval.v_list) != NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4720 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4721 // To some extent make sure that we are dealing with a list from |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4722 // "getmatches()". |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4723 li = l->lv_first; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4724 while (li != NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4725 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4726 if (li->li_tv.v_type != VAR_DICT |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4727 || (d = li->li_tv.vval.v_dict) == NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4728 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4729 emsg(_(e_invarg)); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4730 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4731 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4732 if (!(dict_find(d, (char_u *)"group", -1) != NULL |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4733 && (dict_find(d, (char_u *)"pattern", -1) != NULL |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4734 || dict_find(d, (char_u *)"pos1", -1) != NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4735 && dict_find(d, (char_u *)"priority", -1) != NULL |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4736 && dict_find(d, (char_u *)"id", -1) != NULL)) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4737 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4738 emsg(_(e_invarg)); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4739 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4740 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4741 li = li->li_next; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4742 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4743 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4744 clear_matches(win); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4745 li = l->lv_first; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4746 while (li != NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4747 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4748 int i = 0; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4749 char buf[30]; // use 30 to avoid compiler warning |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4750 dictitem_T *di; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4751 char_u *group; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4752 int priority; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4753 int id; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4754 char_u *conceal; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4755 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4756 d = li->li_tv.vval.v_dict; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4757 if (dict_find(d, (char_u *)"pattern", -1) == NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4758 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4759 if (s == NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4760 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4761 s = list_alloc(); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4762 if (s == NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4763 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4764 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4765 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4766 // match from matchaddpos() |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4767 for (i = 1; i < 9; i++) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4768 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4769 sprintf((char *)buf, (char *)"pos%d", i); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4770 if ((di = dict_find(d, (char_u *)buf, -1)) != NULL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4771 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4772 if (di->di_tv.v_type != VAR_LIST) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4773 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4774 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4775 list_append_tv(s, &di->di_tv); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4776 s->lv_refcount++; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4777 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4778 else |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4779 break; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4780 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4781 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4782 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4783 group = dict_get_string(d, (char_u *)"group", TRUE); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4784 priority = (int)dict_get_number(d, (char_u *)"priority"); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4785 id = (int)dict_get_number(d, (char_u *)"id"); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4786 conceal = dict_find(d, (char_u *)"conceal", -1) != NULL |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4787 ? dict_get_string(d, (char_u *)"conceal", TRUE) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4788 : NULL; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4789 if (i == 0) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4790 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4791 match_add(win, group, |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4792 dict_get_string(d, (char_u *)"pattern", FALSE), |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4793 priority, id, NULL, conceal); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4794 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4795 else |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4796 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4797 match_add(win, group, NULL, priority, id, s, conceal); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4798 list_unref(s); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4799 s = NULL; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4800 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4801 vim_free(group); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4802 vim_free(conceal); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4803 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4804 li = li->li_next; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4805 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4806 rettv->vval.v_number = 0; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4807 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4808 #endif |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4809 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4810 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4811 /* |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4812 * "matchadd()" function |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4813 */ |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4814 void |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4815 f_matchadd(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4816 { |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4817 # ifdef FEAT_SEARCH_EXTRA |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4818 char_u buf[NUMBUFLEN]; |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4819 char_u *grp = tv_get_string_buf_chk(&argvars[0], buf); // group |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4820 char_u *pat = tv_get_string_buf_chk(&argvars[1], buf); // pattern |
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4821 int prio = 10; // default priority |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4822 int id = -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4823 int error = FALSE; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4824 char_u *conceal_char = NULL; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4825 win_T *win = curwin; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4826 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4827 rettv->vval.v_number = -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4828 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4829 if (grp == NULL || pat == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4830 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4831 if (argvars[2].v_type != VAR_UNKNOWN) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4832 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4833 prio = (int)tv_get_number_chk(&argvars[2], &error); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4834 if (argvars[3].v_type != VAR_UNKNOWN) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4835 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4836 id = (int)tv_get_number_chk(&argvars[3], &error); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4837 if (argvars[4].v_type != VAR_UNKNOWN |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4838 && matchadd_dict_arg(&argvars[4], &conceal_char, &win) == FAIL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4839 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4840 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4841 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4842 if (error == TRUE) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4843 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4844 if (id >= 1 && id <= 3) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4845 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4846 semsg(_("E798: ID is reserved for \":match\": %d"), id); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4847 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4848 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4849 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4850 rettv->vval.v_number = match_add(win, grp, pat, prio, id, NULL, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4851 conceal_char); |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4852 # endif |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4853 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4854 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4855 /* |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4856 * "matchaddpos()" function |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4857 */ |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4858 void |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4859 f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4860 { |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4861 # ifdef FEAT_SEARCH_EXTRA |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4862 char_u buf[NUMBUFLEN]; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4863 char_u *group; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4864 int prio = 10; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4865 int id = -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4866 int error = FALSE; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4867 list_T *l; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4868 char_u *conceal_char = NULL; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4869 win_T *win = curwin; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4870 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4871 rettv->vval.v_number = -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4872 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4873 group = tv_get_string_buf_chk(&argvars[0], buf); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4874 if (group == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4875 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4876 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4877 if (argvars[1].v_type != VAR_LIST) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4878 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4879 semsg(_(e_listarg), "matchaddpos()"); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4880 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4881 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4882 l = argvars[1].vval.v_list; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4883 if (l == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4884 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4885 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4886 if (argvars[2].v_type != VAR_UNKNOWN) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4887 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4888 prio = (int)tv_get_number_chk(&argvars[2], &error); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4889 if (argvars[3].v_type != VAR_UNKNOWN) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4890 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4891 id = (int)tv_get_number_chk(&argvars[3], &error); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4892 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4893 if (argvars[4].v_type != VAR_UNKNOWN |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4894 && matchadd_dict_arg(&argvars[4], &conceal_char, &win) == FAIL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4895 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4896 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4897 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4898 if (error == TRUE) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4899 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4900 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4901 // id == 3 is ok because matchaddpos() is supposed to substitute :3match |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4902 if (id == 1 || id == 2) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4903 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4904 semsg(_("E798: ID is reserved for \":match\": %d"), id); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4905 return; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4906 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4907 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4908 rettv->vval.v_number = match_add(win, group, NULL, prio, id, l, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4909 conceal_char); |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4910 # endif |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4911 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4912 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4913 /* |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4914 * "matcharg()" function |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4915 */ |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4916 void |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4917 f_matcharg(typval_T *argvars UNUSED, typval_T *rettv) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4918 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4919 if (rettv_list_alloc(rettv) == OK) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4920 { |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4921 # ifdef FEAT_SEARCH_EXTRA |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4922 int id = (int)tv_get_number(&argvars[0]); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4923 matchitem_T *m; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4924 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4925 if (id >= 1 && id <= 3) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4926 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4927 if ((m = (matchitem_T *)get_match(curwin, id)) != NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4928 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4929 list_append_string(rettv->vval.v_list, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4930 syn_id2name(m->hlg_id), -1); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4931 list_append_string(rettv->vval.v_list, m->pattern, -1); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4932 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4933 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4934 { |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4935 list_append_string(rettv->vval.v_list, NULL, -1); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4936 list_append_string(rettv->vval.v_list, NULL, -1); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4937 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4938 } |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4939 # endif |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4940 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4941 } |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4942 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4943 /* |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4944 * "matchdelete()" function |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4945 */ |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4946 void |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4947 f_matchdelete(typval_T *argvars UNUSED, typval_T *rettv UNUSED) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4948 { |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4949 # ifdef FEAT_SEARCH_EXTRA |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4950 win_T *win = get_optional_window(argvars, 1); |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4951 |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4952 if (win == NULL) |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4953 rettv->vval.v_number = -1; |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4954 else |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4955 rettv->vval.v_number = match_delete(win, |
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4956 (int)tv_get_number(&argvars[0]), TRUE); |
17474
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4957 # endif |
f8c197962c1e
patch 8.1.1735: can't build with tiny features
Bram Moolenaar <Bram@vim.org>
parents:
17472
diff
changeset
|
4958 } |
17472
dfd87ef822aa
patch 8.1.1734: the evalfunc.c file is too big
Bram Moolenaar <Bram@vim.org>
parents:
17401
diff
changeset
|
4959 #endif |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4960 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4961 #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4962 /* |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4963 * ":[N]match {group} {pattern}" |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4964 * Sets nextcmd to the start of the next command, if any. Also called when |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4965 * skipping commands to find the next command. |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4966 */ |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4967 void |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4968 ex_match(exarg_T *eap) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4969 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4970 char_u *p; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4971 char_u *g = NULL; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4972 char_u *end; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4973 int c; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4974 int id; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4975 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4976 if (eap->line2 <= 3) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4977 id = eap->line2; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4978 else |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4979 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4980 emsg(_(e_invcmd)); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4981 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4982 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4983 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
4984 // First clear any old pattern. |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4985 if (!eap->skip) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4986 match_delete(curwin, id, FALSE); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4987 |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
4988 if (ends_excmd2(eap->cmd, eap->arg)) |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4989 end = eap->arg; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4990 else if ((STRNICMP(eap->arg, "none", 4) == 0 |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
4991 && (VIM_ISWHITE(eap->arg[4]) |
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
4992 || ends_excmd2(eap->arg, eap->arg + 4)))) |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4993 end = eap->arg + 4; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4994 else |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4995 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4996 p = skiptowhite(eap->arg); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4997 if (!eap->skip) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4998 g = vim_strnsave(eap->arg, (int)(p - eap->arg)); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
4999 p = skipwhite(p); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5000 if (*p == NUL) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5001 { |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
5002 // There must be two arguments. |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5003 vim_free(g); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5004 semsg(_(e_invarg2), eap->arg); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5005 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5006 } |
19892
5feb426d2ea1
patch 8.2.0502: Vim9: some code is not tested
Bram Moolenaar <Bram@vim.org>
parents:
19756
diff
changeset
|
5007 end = skip_regexp(p + 1, *p, TRUE); |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5008 if (!eap->skip) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5009 { |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
5010 if (*end != NUL && !ends_excmd2(end, skipwhite(end + 1))) |
17488
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5011 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5012 vim_free(g); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5013 eap->errmsg = e_trailing; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5014 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5015 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5016 if (*end != *p) |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5017 { |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5018 vim_free(g); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5019 semsg(_(e_invarg2), p); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5020 return; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5021 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5022 |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5023 c = *end; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5024 *end = NUL; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5025 match_add(curwin, g, p + 1, 10, id, NULL, NULL); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5026 vim_free(g); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5027 *end = c; |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5028 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5029 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5030 eap->nextcmd = find_nextcmd(end); |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5031 } |
bba80d61ea73
patch 8.1.1742: still some match functions in evalfunc.c
Bram Moolenaar <Bram@vim.org>
parents:
17486
diff
changeset
|
5032 #endif |