Mercurial > vim
annotate src/highlight.c @ 36081:f36c3455e686 v9.1.0709
patch 9.1.0709: GUIEnter event not found in Turkish locale
Commit: https://github.com/vim/vim/commit/84e3175c4e70486b52e15cc6c40095fa311c1107
Author: Christian Brabandt <cb@256bit.org>
Date: Mon Sep 2 09:59:18 2024 +0200
patch 9.1.0709: GUIEnter event not found in Turkish locale
Problem: GUIEnter not found in Turkish locale
(James McCoy, after v9.1.0256, the issue was there before,
but v9.1.0256 made it more apparent)
Solution: explicitly compare autocommand events by ASCII value and
ignoring locale, because according to the documentation,
events are case insensitive (:h autocommand-events)
fixes: #15574
closes: #15603
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 02 Sep 2024 10:15:03 +0200 |
parents | 3ead9668d632 |
children | 2eb1862d58e6 |
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. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
12 */ |
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 #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
|
15 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
16 #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
|
17 #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
|
18 #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
|
19 #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
|
20 |
26454
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
21 #define MAX_SYN_NAME 200 |
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
22 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
23 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
24 * 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
|
25 * 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
|
26 */ |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
27 // must be sorted by the 'value' field because it is used by bsearch()! |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
28 // note: inverse and reverse use the same key |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
29 static keyvalue_T highlight_tab[] = { |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
30 KEYVALUE_ENTRY(HL_BOLD, "bold"), // index 0 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
31 KEYVALUE_ENTRY(HL_INVERSE, "inverse"), // index 1 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
32 KEYVALUE_ENTRY(HL_ITALIC, "italic"), // index 2 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
33 KEYVALUE_ENTRY(HL_NOCOMBINE, "nocombine"), // index 3 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
34 KEYVALUE_ENTRY(HL_NORMAL, "NONE"), // index 4 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
35 KEYVALUE_ENTRY(HL_INVERSE, "reverse"), // index 5 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
36 KEYVALUE_ENTRY(HL_STANDOUT, "standout"), // index 6 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
37 KEYVALUE_ENTRY(HL_STRIKETHROUGH, "strikethrough"), // index 7 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
38 KEYVALUE_ENTRY(HL_UNDERCURL, "undercurl"), // index 8 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
39 KEYVALUE_ENTRY(HL_UNDERDASHED, "underdashed"), // index 9 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
40 KEYVALUE_ENTRY(HL_UNDERDOTTED, "underdotted"), // index 10 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
41 KEYVALUE_ENTRY(HL_UNDERDOUBLE, "underdouble"), // index 11 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
42 KEYVALUE_ENTRY(HL_UNDERLINE, "underline") // index 12 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
43 }; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
44 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
45 // this table is used to display highlight names in the "correct" sequence. |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
46 // keep this in sync with highlight_tab[]. |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
47 static keyvalue_T *highlight_index_tab[] = { |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
48 &highlight_tab[0], // HL_BOLD |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
49 &highlight_tab[6], // HL_STANDOUT |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
50 &highlight_tab[12], // HL_UNDERLINE |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
51 &highlight_tab[8], // HL_UNDERCURL |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
52 &highlight_tab[11], // HL_UNDERDOUBLE |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
53 &highlight_tab[10], // HL_UNDERDOTTED |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
54 &highlight_tab[9], // HL_UNDERDASHED |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
55 &highlight_tab[2], // HL_ITALIC |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
56 &highlight_tab[5], // HL_REVERSE |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
57 &highlight_tab[1], // HL_INVERSE |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
58 &highlight_tab[3], // HL_NOCOMBINE |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
59 &highlight_tab[7], // HL_STRIKETHROUGH |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
60 &highlight_tab[4] // HL_NORMAL |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
61 }; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
62 |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
63 // length of all attribute names, plus commas, together (and a bit more) |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
64 #define MAX_ATTR_LEN 120 |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
65 |
27752
c1d1639b52dd
patch 8.2.4402: missing parenthesis may cause unexpected problems
Bram Moolenaar <Bram@vim.org>
parents:
27032
diff
changeset
|
66 #define ATTR_COMBINE(attr_a, attr_b) ((((attr_b) & HL_NOCOMBINE) ? (attr_b) : (attr_a)) | (attr_b)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
67 |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
68 enum { |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
69 BLACK = 0, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
70 DARKBLUE, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
71 DARKGREEN, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
72 DARKCYAN, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
73 DARKRED, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
74 DARKMAGENTA, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
75 BROWN, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
76 DARKYELLOW, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
77 GRAY, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
78 GREY, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
79 LIGHTGRAY, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
80 LIGHTGREY, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
81 DARKGRAY, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
82 DARKGREY, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
83 BLUE, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
84 LIGHTBLUE, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
85 GREEN, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
86 LIGHTGREEN, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
87 CYAN, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
88 LIGHTCYAN, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
89 RED, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
90 LIGHTRED, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
91 MAGENTA, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
92 LIGHTMAGENTA, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
93 YELLOW, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
94 LIGHTYELLOW, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
95 WHITE, |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
96 NONE |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
97 }; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
98 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
99 // must be sorted by the 'value' field because it is used by bsearch()! |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
100 static keyvalue_T color_name_tab[] = { |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
101 KEYVALUE_ENTRY(BLACK, "Black"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
102 KEYVALUE_ENTRY(BLUE, "Blue"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
103 KEYVALUE_ENTRY(BROWN, "Brown"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
104 KEYVALUE_ENTRY(CYAN, "Cyan"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
105 KEYVALUE_ENTRY(DARKBLUE, "DarkBlue"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
106 KEYVALUE_ENTRY(DARKCYAN, "DarkCyan"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
107 KEYVALUE_ENTRY(DARKGRAY, "DarkGray"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
108 KEYVALUE_ENTRY(DARKGREEN, "DarkGreen"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
109 KEYVALUE_ENTRY(DARKGREY, "DarkGrey"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
110 KEYVALUE_ENTRY(DARKMAGENTA, "DarkMagenta"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
111 KEYVALUE_ENTRY(DARKRED, "DarkRed"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
112 KEYVALUE_ENTRY(DARKYELLOW, "DarkYellow"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
113 KEYVALUE_ENTRY(GRAY, "Gray"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
114 KEYVALUE_ENTRY(GREEN, "Green"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
115 KEYVALUE_ENTRY(GREY, "Grey"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
116 KEYVALUE_ENTRY(LIGHTBLUE, "LightBlue"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
117 KEYVALUE_ENTRY(LIGHTCYAN, "LightCyan"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
118 KEYVALUE_ENTRY(LIGHTGRAY, "LightGray"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
119 KEYVALUE_ENTRY(LIGHTGREEN, "LightGreen"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
120 KEYVALUE_ENTRY(LIGHTGREY, "LightGrey"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
121 KEYVALUE_ENTRY(LIGHTMAGENTA, "LightMagenta"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
122 KEYVALUE_ENTRY(LIGHTRED, "LightRed"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
123 KEYVALUE_ENTRY(LIGHTYELLOW, "LightYellow"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
124 KEYVALUE_ENTRY(MAGENTA, "Magenta"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
125 KEYVALUE_ENTRY(NONE, "NONE"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
126 KEYVALUE_ENTRY(RED, "Red"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
127 KEYVALUE_ENTRY(WHITE, "White"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
128 KEYVALUE_ENTRY(YELLOW, "Yellow") |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
129 }; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
130 |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
131 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
132 * 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
|
133 * 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
|
134 * 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
|
135 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
136 typedef struct |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
137 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
138 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
|
139 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
|
140 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
|
141 // 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 // 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
|
147 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
|
148 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
|
149 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
|
150 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
|
151 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
|
152 int sg_cterm_attr; // Screen attr for color term mode |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
153 int sg_cterm_font; // terminal alternative font (0 for normal) |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
154 // 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
|
155 #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
|
156 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
|
157 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
|
158 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
|
159 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
160 #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
|
161 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
|
162 #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
|
163 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
|
164 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
165 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
|
166 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
|
167 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
168 #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
|
169 // 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
|
170 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
|
171 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
|
172 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
|
173 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
|
174 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
175 int sg_link; // link to this highlight group ID |
22308
19e0784ef769
patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents:
22288
diff
changeset
|
176 int sg_deflink; // default link; restored in highlight_clear() |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
177 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
|
178 #ifdef FEAT_EVAL |
22312
e06ba60fbbd8
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents:
22308
diff
changeset
|
179 sctx_T sg_deflink_sctx; // script where the default link was set |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
180 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
|
181 #endif |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
182 } 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
|
183 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
184 // 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
|
185 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
|
186 #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
|
187 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
188 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
189 * 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
|
190 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
191 #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
|
192 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
193 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
|
194 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
|
195 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
|
196 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
|
197 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
|
198 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
|
199 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
|
200 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
201 #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
|
202 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
|
203 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 #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
|
205 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
|
206 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
|
207 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
208 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
209 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
210 * 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
|
211 * 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
|
212 * 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
|
213 * 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
|
214 * 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
|
215 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 #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
|
217 # 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
|
218 #else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
219 # 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
|
220 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 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
|
222 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
|
223 "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
|
224 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
|
225 "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
|
226 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
|
227 "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
|
228 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
|
229 "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
|
230 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
|
231 "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
|
232 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
|
233 "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
|
234 "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
|
235 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
|
236 "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
|
237 #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
|
238 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
|
239 "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
|
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_DIFF |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 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
|
243 "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
|
244 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
245 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
|
246 "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
|
247 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
|
248 "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
|
249 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
|
250 "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
|
251 #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
|
252 "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
|
253 "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
|
254 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
255 "default link QuickFixLine Search", |
26266
365e7f083f02
patch 8.2.3664: cannot adjust sign highlighting for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
256 "default link CursorLineSign SignColumn", |
365e7f083f02
patch 8.2.3664: cannot adjust sign highlighting for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents:
26193
diff
changeset
|
257 "default link CursorLineFold FoldColumn", |
28399
d395fadbaf67
patch 8.2.4724: current instance of last search pattern not easily spotted
Bram Moolenaar <Bram@vim.org>
parents:
28315
diff
changeset
|
258 "default link CurSearch Search", |
32132
059e89bf9316
patch 9.0.1397: highlight for popupmenu kind and extra cannot be set
Bram Moolenaar <Bram@vim.org>
parents:
32009
diff
changeset
|
259 "default link PmenuKind Pmenu", |
059e89bf9316
patch 9.0.1397: highlight for popupmenu kind and extra cannot be set
Bram Moolenaar <Bram@vim.org>
parents:
32009
diff
changeset
|
260 "default link PmenuKindSel PmenuSel", |
35375
76f1a20420fd
patch 9.1.0476: Cannot see matched text in popup menu
Christian Brabandt <cb@256bit.org>
parents:
34838
diff
changeset
|
261 "default link PmenuMatch Pmenu", |
76f1a20420fd
patch 9.1.0476: Cannot see matched text in popup menu
Christian Brabandt <cb@256bit.org>
parents:
34838
diff
changeset
|
262 "default link PmenuMatchSel PmenuSel", |
32132
059e89bf9316
patch 9.0.1397: highlight for popupmenu kind and extra cannot be set
Bram Moolenaar <Bram@vim.org>
parents:
32009
diff
changeset
|
263 "default link PmenuExtra Pmenu", |
059e89bf9316
patch 9.0.1397: highlight for popupmenu kind and extra cannot be set
Bram Moolenaar <Bram@vim.org>
parents:
32009
diff
changeset
|
264 "default link PmenuExtraSel PmenuSel", |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
265 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
|
266 NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
267 }; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
269 // 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
|
270 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
|
271 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
|
272 "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
|
273 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
|
274 "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
|
275 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
|
276 "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
|
277 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
|
278 "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
|
279 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
|
280 "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
|
281 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
|
282 "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
|
283 #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
|
284 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
|
285 "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
|
286 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
|
287 "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
|
288 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
|
289 "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
|
290 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
|
291 "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
|
292 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
293 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
|
294 "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
|
295 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
|
296 "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
|
297 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
|
298 "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
|
299 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
|
300 "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
|
301 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
|
302 "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
|
303 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
|
304 "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
|
305 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
|
306 "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
|
307 #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
|
308 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
|
309 "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
|
310 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
|
311 "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
|
312 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
313 #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
|
314 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
|
315 "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
|
316 #endif |
34255
ccd1a35157ad
patch 9.1.0068: Visual highlighting can still be improved
Christian Brabandt <cb@256bit.org>
parents:
34232
diff
changeset
|
317 CENT("Visual ctermbg=Grey ctermfg=Black", |
34347
3cbe1e26d561
patch 9.1.0106: Visual highlight hard to read with 'termguicolors'
Christian Brabandt <cb@256bit.org>
parents:
34255
diff
changeset
|
318 "Visual ctermbg=Grey ctermfg=Black guibg=LightGrey guifg=Black"), |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
319 #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
|
320 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
|
321 "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
|
322 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
|
323 "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
|
324 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
|
325 "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
|
326 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
327 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
|
328 "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
|
329 #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
|
330 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
|
331 "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
|
332 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
|
333 "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
|
334 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
|
335 "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
|
336 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
337 #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
|
338 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
|
339 "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
|
340 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
341 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
|
342 "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
|
343 #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
|
344 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
|
345 "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
|
346 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
|
347 "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
|
348 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
349 #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
|
350 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
|
351 "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
|
352 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
|
353 "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
|
354 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
355 NULL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
356 }; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
357 |
17494
c8df7f8ccdf8
patch 8.1.1745: compiler warning for unused argument
Bram Moolenaar <Bram@vim.org>
parents:
17490
diff
changeset
|
358 // 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
|
359 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
|
360 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
|
361 "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
|
362 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
|
363 "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
|
364 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
|
365 "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
|
366 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
|
367 "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
|
368 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
|
369 "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
|
370 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
|
371 "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
|
372 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
|
373 "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
|
374 #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
|
375 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
|
376 "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
|
377 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
|
378 "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
|
379 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
|
380 "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
|
381 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
|
382 "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
|
383 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
384 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
|
385 "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
|
386 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
|
387 "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
|
388 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
|
389 "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
|
390 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
|
391 "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
|
392 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
|
393 "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
|
394 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
|
395 "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
|
396 #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
|
397 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
|
398 "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
|
399 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
|
400 "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
|
401 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
402 #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
|
403 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
|
404 "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
|
405 #endif |
34232
47385c831d92
patch 9.1.0061: UX of visual highlighting can be improved
Christian Brabandt <cb@256bit.org>
parents:
34136
diff
changeset
|
406 CENT("Visual ctermbg=Grey ctermfg=Black", |
34347
3cbe1e26d561
patch 9.1.0106: Visual highlight hard to read with 'termguicolors'
Christian Brabandt <cb@256bit.org>
parents:
34255
diff
changeset
|
407 "Visual ctermbg=Grey ctermfg=Black guibg=#575757 guifg=LightGrey"), |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
408 #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
|
409 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
|
410 "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
|
411 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
|
412 "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
|
413 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
|
414 "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
|
415 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
416 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
|
417 "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
|
418 #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
|
419 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
|
420 "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
|
421 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
|
422 "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
|
423 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
|
424 "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
|
425 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
426 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
|
427 "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
|
428 #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
|
429 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
|
430 "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
|
431 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
432 #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
|
433 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
|
434 "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
|
435 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
|
436 "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
|
437 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
438 #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
|
439 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
|
440 "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
|
441 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
|
442 "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
|
443 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
444 NULL |
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 |
27018
268f6a3511df
patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents:
26962
diff
changeset
|
447 #if defined(FEAT_SYN_HL) || defined(PROTO) |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
448 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
449 * 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
|
450 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
451 int |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
452 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
|
453 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
454 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
|
455 } |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
456 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
457 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
458 * 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
|
459 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
460 char_u * |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
461 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
|
462 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
463 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
|
464 } |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
465 |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
466 /* |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
467 * 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
|
468 */ |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
469 int |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
470 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
|
471 { |
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
472 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
|
473 } |
27018
268f6a3511df
patch 8.2.4038: various code not used when features are disabled
Bram Moolenaar <Bram@vim.org>
parents:
26962
diff
changeset
|
474 #endif |
17401
5462bb963075
patch 8.1.1699: highlight_ga can be local instead of global
Bram Moolenaar <Bram@vim.org>
parents:
17389
diff
changeset
|
475 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
476 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
477 init_highlight( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
478 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
|
479 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
|
480 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
481 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
482 char **pp; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
483 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
|
484 #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
|
485 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
|
486 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
487 // Try finding the color scheme file. Used when a color file was loaded |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
488 // and 'background' or 't_Co' is changed. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
489 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
|
490 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
|
491 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
492 // 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
|
493 // 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
|
494 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
|
495 int r; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
496 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
497 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
|
498 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
499 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
|
500 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
|
501 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
|
502 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
503 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
504 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
505 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
506 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
507 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
508 // Didn't use a color file, use the compiled-in colors. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
509 if (both) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
510 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
511 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
|
512 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
|
513 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
|
514 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
|
515 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
516 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
|
517 // 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
|
518 // 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
|
519 // everything anyway. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
520 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
521 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
522 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
|
523 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
|
524 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
525 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
|
526 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
|
527 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
|
528 |
34255
ccd1a35157ad
patch 9.1.0068: Visual highlighting can still be improved
Christian Brabandt <cb@256bit.org>
parents:
34232
diff
changeset
|
529 // Reverse looks ugly, but grey may not work for less than 8 colors. Thus |
ccd1a35157ad
patch 9.1.0068: Visual highlighting can still be improved
Christian Brabandt <cb@256bit.org>
parents:
34232
diff
changeset
|
530 // let it depend on the number of colors available. |
ccd1a35157ad
patch 9.1.0068: Visual highlighting can still be improved
Christian Brabandt <cb@256bit.org>
parents:
34232
diff
changeset
|
531 if (t_colors < 8) |
ccd1a35157ad
patch 9.1.0068: Visual highlighting can still be improved
Christian Brabandt <cb@256bit.org>
parents:
34232
diff
changeset
|
532 do_highlight((char_u *)"Visual term=reverse cterm=reverse ctermbg=NONE ctermfg=NONE", |
ccd1a35157ad
patch 9.1.0068: Visual highlighting can still be improved
Christian Brabandt <cb@256bit.org>
parents:
34232
diff
changeset
|
533 FALSE, TRUE); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
534 // 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
|
535 // 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
|
536 // Clear the attributes, needed when changing the t_Co value. |
34232
47385c831d92
patch 9.1.0061: UX of visual highlighting can be improved
Christian Brabandt <cb@256bit.org>
parents:
34136
diff
changeset
|
537 if (t_colors <= 8) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
538 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
539 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
|
540 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
|
541 } |
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 #ifdef FEAT_SYN_HL |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
544 // If syntax highlighting is enabled load the highlighting for it. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
545 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
|
546 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
547 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
|
548 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
549 if (recursive >= 5) |
26952
b34ddbca305c
patch 8.2.4005: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26915
diff
changeset
|
550 emsg(_(e_recursive_loop_loading_syncolor_vim)); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
551 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
552 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
553 ++recursive; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
554 (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
|
555 --recursive; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
556 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
557 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
558 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
559 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
560 |
27032
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
561 #if defined(FEAT_EVAL) && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
562 /* |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
563 * Load a default color list. Intended to support legacy color names but allows |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
564 * the user to override the color values. Only loaded once. |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
565 */ |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
566 static void |
32009
4545f58c8490
patch 9.0.1336: functions without arguments are not always declared properly
Bram Moolenaar <Bram@vim.org>
parents:
31667
diff
changeset
|
567 load_default_colors_lists(void) |
27032
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
568 { |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
569 // Lacking a default color list isn't the end of the world but it is likely |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
570 // an inconvenience so users should know when it is missing. |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
571 if (source_runtime((char_u *)"colors/lists/default.vim", DIP_ALL) != OK) |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
572 msg("failed to load colors/lists/default.vim"); |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
573 } |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
574 #endif |
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
575 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
576 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
577 * 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
|
578 * 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
|
579 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
580 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
581 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
|
582 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
583 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
|
584 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
|
585 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
|
586 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
587 // 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
|
588 // '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
|
589 // 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
|
590 if (recursive) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
591 return OK; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
592 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
593 recursive = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
594 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
|
595 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
|
596 { |
26059
c7e09c069ece
patch 8.2.3563: build failure with +eval but without GUI or +termguicolors
Bram Moolenaar <Bram@vim.org>
parents:
26057
diff
changeset
|
597 #if defined(FEAT_EVAL) && (defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS)) |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
598 load_default_colors_lists(); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
599 #endif |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
600 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
|
601 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
|
602 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
|
603 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
|
604 vim_free(buf); |
30011
b8abb8908801
patch 9.0.0343: ColorScheme autocommand triggered when colorscheme not found
Bram Moolenaar <Bram@vim.org>
parents:
30005
diff
changeset
|
605 if (retval == OK) |
b8abb8908801
patch 9.0.0343: ColorScheme autocommand triggered when colorscheme not found
Bram Moolenaar <Bram@vim.org>
parents:
30005
diff
changeset
|
606 apply_autocmds(EVENT_COLORSCHEME, name, curbuf->b_fname, |
b8abb8908801
patch 9.0.0343: ColorScheme autocommand triggered when colorscheme not found
Bram Moolenaar <Bram@vim.org>
parents:
30005
diff
changeset
|
607 FALSE, curbuf); |
17389
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 recursive = FALSE; |
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 return retval; |
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 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
614 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
|
615 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
|
616 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
|
617 8, 8, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
618 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
|
619 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
|
620 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
|
621 // 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
|
622 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
|
623 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
|
624 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
|
625 82, 82, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
626 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
|
627 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
|
628 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
|
629 // 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
|
630 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
|
631 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
|
632 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
|
633 242, 242, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
634 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
|
635 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
|
636 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
|
637 // 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
|
638 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
|
639 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
|
640 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
|
641 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
|
642 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
|
643 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
|
644 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
|
645 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
646 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
647 * Lookup the "cterm" value to be used for color with index "idx" in |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
648 * color_name_tab[]. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
649 * "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
|
650 * 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
|
651 */ |
29320
a74398c432a4
patch 9.0.0003: functions are global while they could be local
Bram Moolenaar <Bram@vim.org>
parents:
28809
diff
changeset
|
652 static int |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
653 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
|
654 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
655 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
|
656 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
|
657 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
658 // 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
|
659 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
|
660 return -1; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
661 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
662 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
|
663 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
664 // 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
|
665 #if defined(__QNXNTO__) |
18806
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
666 // 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
|
667 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
|
668 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
|
669 else |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
670 #endif |
18806
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
671 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
|
672 if (foreground) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
673 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
674 // 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
|
675 // 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
|
676 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
|
677 *boldp = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
678 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
679 *boldp = FALSE; |
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 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
|
682 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
683 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
|
684 || 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
|
685 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
686 // Guess: if the termcap entry ends in 'm', it is |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
687 // probably an xterm-like terminal. Use the changed |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
688 // order for colors. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
689 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
|
690 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
|
691 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
692 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
|
693 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
|
694 || *(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
|
695 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
696 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
|
697 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
|
698 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
|
699 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
|
700 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
701 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
|
702 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
703 #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
|
704 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
|
705 // 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
|
706 // 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
|
707 color = 231; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
708 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
709 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
710 return color; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
711 } |
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 /* |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
714 * Link highlight group 'from_hg' to 'to_hg'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
715 * 'dodefault' is set to TRUE for ":highlight default link". |
30986
360f286b5869
patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents:
30053
diff
changeset
|
716 * 'forceit' is set to TRUE for ":highlight! link" |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
717 * 'init' is set to TRUE when initializing all the highlight groups. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
718 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
719 static void |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
720 highlight_group_link( |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
721 char_u *from_hg, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
722 int from_len, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
723 char_u *to_hg, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
724 int to_len, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
725 int dodefault, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
726 int forceit, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
727 int init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
728 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
729 int from_id; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
730 int to_id; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
731 hl_group_T *hlgroup = NULL; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
732 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
733 from_id = syn_check_group(from_hg, from_len); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
734 if (STRNCMP(to_hg, "NONE", 4) == 0) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
735 to_id = 0; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
736 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
737 to_id = syn_check_group(to_hg, to_len); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
738 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
739 if (from_id > 0) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
740 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
741 hlgroup = &HL_TABLE()[from_id - 1]; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
742 if (dodefault && (forceit || hlgroup->sg_deflink == 0)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
743 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
744 hlgroup->sg_deflink = to_id; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
745 #ifdef FEAT_EVAL |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
746 hlgroup->sg_deflink_sctx = current_sctx; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
747 hlgroup->sg_deflink_sctx.sc_lnum += SOURCING_LNUM; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
748 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
749 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
750 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
751 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
752 if (from_id > 0 && (!init || hlgroup->sg_set == 0)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
753 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
754 // Don't allow a link when there already is some highlighting |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
755 // for the group, unless '!' is used |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
756 if (to_id > 0 && !forceit && !init |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
757 && hl_has_settings(from_id - 1, dodefault)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
758 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
759 if (SOURCING_NAME == NULL && !dodefault) |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
760 emsg(_(e_group_has_settings_highlight_link_ignored)); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
761 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
762 else if (hlgroup->sg_link != to_id |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
763 #ifdef FEAT_EVAL |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
764 || hlgroup->sg_script_ctx.sc_sid != current_sctx.sc_sid |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
765 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
766 || hlgroup->sg_cleared) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
767 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
768 if (!init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
769 hlgroup->sg_set |= SG_LINK; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
770 hlgroup->sg_link = to_id; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
771 #ifdef FEAT_EVAL |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
772 hlgroup->sg_script_ctx = current_sctx; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
773 hlgroup->sg_script_ctx.sc_lnum += SOURCING_LNUM; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
774 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
775 hlgroup->sg_cleared = FALSE; |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29726
diff
changeset
|
776 redraw_all_later(UPD_SOME_VALID); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
777 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
778 // Only call highlight_changed() once after multiple changes. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
779 need_highlight_changed = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
780 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
781 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
782 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
783 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
784 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
785 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
786 * Reset all highlighting to the defaults. Removes all highlighting for the |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
787 * groups added by the user. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
788 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
789 static void |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
790 highlight_reset_all(void) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
791 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
792 int idx; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
793 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
794 #ifdef FEAT_GUI |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
795 // First, we do not destroy the old values, but allocate the new |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
796 // ones and update the display. THEN we destroy the old values. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
797 // If we destroy the old values first, then the old values |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
798 // (such as GuiFont's or GuiFontset's) will still be displayed but |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
799 // invalid because they were free'd. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
800 if (gui.in_use) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
801 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
802 # ifdef FEAT_BEVAL_TIP |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
803 gui_init_tooltip_font(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
804 # endif |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
27752
diff
changeset
|
805 # if defined(FEAT_MENU) && defined(FEAT_GUI_MOTIF) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
806 gui_init_menu_font(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
807 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
808 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
809 # if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_X11) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
810 gui_mch_def_colors(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
811 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
812 # ifdef FEAT_GUI_X11 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
813 # ifdef FEAT_MENU |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
814 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
815 // This only needs to be done when there is no Menu highlight |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
816 // group defined by default, which IS currently the case. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
817 gui_mch_new_menu_colors(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
818 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
819 if (gui.in_use) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
820 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
821 gui_new_scrollbar_colors(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
822 # ifdef FEAT_BEVAL_GUI |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
823 gui_mch_new_tooltip_colors(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
824 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
825 # ifdef FEAT_MENU |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
826 gui_mch_new_menu_font(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
827 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
828 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
829 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
830 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
831 // Ok, we're done allocating the new default graphics items. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
832 // The screen should already be refreshed at this point. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
833 // It is now Ok to clear out the old data. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
834 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
835 #ifdef FEAT_EVAL |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
836 do_unlet((char_u *)"g:colors_name", TRUE); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
837 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
838 restore_cterm_colors(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
839 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
840 // Clear all default highlight groups and load the defaults. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
841 for (idx = 0; idx < highlight_ga.ga_len; ++idx) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
842 highlight_clear(idx); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
843 init_highlight(TRUE, TRUE); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
844 #if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
845 if (USE_24BIT) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
846 highlight_gui_started(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
847 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
848 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
849 highlight_changed(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
850 redraw_later_clear(); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
851 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
852 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
853 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
854 * Set the 'term' or 'cterm' or 'gui' attributes for the highlight group at |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
855 * index 'idx'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
856 * 'key' is one of 'TERM' or 'CTERM' or 'GUI' |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
857 * 'arg' is the list of attribute names separated by comma. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
858 * 'init' is set to TRUE when initializing all the highlight groups. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
859 * Returns TRUE if the attributes are set. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
860 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
861 static int |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
862 highlight_set_termgui_attr(int idx, char_u *key, char_u *arg, int init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
863 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
864 int attr; |
34838
f92e32ddcbdb
patch 9.1.0288: MS-Windows: compiler warning for size_t to int conversion
Christian Brabandt <cb@256bit.org>
parents:
34822
diff
changeset
|
865 size_t off; |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
866 keyvalue_T target; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
867 keyvalue_T *entry; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
868 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
869 attr = 0; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
870 off = 0; |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
871 target.key = 0; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
872 target.length = 0; // not used, see cmp_keyvalue_value_ni() |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
873 while (arg[off] != NUL) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
874 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
875 target.value = (char *)arg + off; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
876 entry = (keyvalue_T *)bsearch(&target, &highlight_tab, ARRAY_LENGTH(highlight_tab), sizeof(highlight_tab[0]), cmp_keyvalue_value_ni); |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
877 if (entry == NULL) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
878 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
879 semsg(_(e_illegal_value_str), arg); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
880 return FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
881 } |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
882 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
883 attr |= entry->key; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
884 off += entry->length; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
885 if (arg[off] == ',') // another one follows |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
886 ++off; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
887 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
888 if (*key == 'T') |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
889 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
890 if (!init || !(HL_TABLE()[idx].sg_set & SG_TERM)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
891 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
892 if (!init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
893 HL_TABLE()[idx].sg_set |= SG_TERM; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
894 HL_TABLE()[idx].sg_term = attr; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
895 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
896 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
897 else if (*key == 'C') |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
898 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
899 if (!init || !(HL_TABLE()[idx].sg_set & SG_CTERM)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
900 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
901 if (!init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
902 HL_TABLE()[idx].sg_set |= SG_CTERM; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
903 HL_TABLE()[idx].sg_cterm = attr; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
904 HL_TABLE()[idx].sg_cterm_bold = FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
905 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
906 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
907 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
908 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
909 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
910 if (!init || !(HL_TABLE()[idx].sg_set & SG_GUI)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
911 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
912 if (!init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
913 HL_TABLE()[idx].sg_set |= SG_GUI; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
914 HL_TABLE()[idx].sg_gui = attr; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
915 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
916 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
917 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
918 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
919 return TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
920 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
921 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
922 #ifdef FEAT_GUI |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
923 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
924 * Set the font for the highlight group at 'idx'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
925 * 'arg' is the font name. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
926 * Returns TRUE if the font is changed. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
927 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
928 static int |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
929 highlight_set_font( |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
930 int idx, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
931 char_u *arg, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
932 int is_normal_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
933 int is_menu_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
934 int is_tooltip_group) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
935 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
936 int did_change = FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
937 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
938 // in non-GUI fonts are simply ignored |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
939 if (HL_TABLE()[idx].sg_font_name != NULL |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
940 && STRCMP(HL_TABLE()[idx].sg_font_name, arg) == 0) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
941 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
942 // Font name didn't change, ignore. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
943 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
944 else if (!gui.shell_created) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
945 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
946 // GUI not started yet, always accept the name. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
947 vim_free(HL_TABLE()[idx].sg_font_name); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
948 HL_TABLE()[idx].sg_font_name = vim_strsave(arg); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
949 did_change = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
950 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
951 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
952 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
953 GuiFont temp_sg_font = HL_TABLE()[idx].sg_font; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
954 # ifdef FEAT_XFONTSET |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
955 GuiFontset temp_sg_fontset = HL_TABLE()[idx].sg_fontset; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
956 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
957 // First, save the current font/fontset. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
958 // Then try to allocate the font/fontset. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
959 // If the allocation fails, HL_TABLE()[idx].sg_font OR |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
960 // sg_fontset will be set to NOFONT or NOFONTSET respectively. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
961 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
962 HL_TABLE()[idx].sg_font = NOFONT; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
963 # ifdef FEAT_XFONTSET |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
964 HL_TABLE()[idx].sg_fontset = NOFONTSET; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
965 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
966 hl_do_font(idx, arg, is_normal_group, is_menu_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
967 is_tooltip_group, FALSE); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
968 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
969 # ifdef FEAT_XFONTSET |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
970 if (HL_TABLE()[idx].sg_fontset != NOFONTSET) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
971 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
972 // New fontset was accepted. Free the old one, if there |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
973 // was one. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
974 gui_mch_free_fontset(temp_sg_fontset); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
975 vim_free(HL_TABLE()[idx].sg_font_name); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
976 HL_TABLE()[idx].sg_font_name = vim_strsave(arg); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
977 did_change = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
978 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
979 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
980 HL_TABLE()[idx].sg_fontset = temp_sg_fontset; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
981 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
982 if (HL_TABLE()[idx].sg_font != NOFONT) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
983 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
984 // New font was accepted. Free the old one, if there was |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
985 // one. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
986 gui_mch_free_font(temp_sg_font); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
987 vim_free(HL_TABLE()[idx].sg_font_name); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
988 HL_TABLE()[idx].sg_font_name = vim_strsave(arg); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
989 did_change = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
990 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
991 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
992 HL_TABLE()[idx].sg_font = temp_sg_font; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
993 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
994 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
995 return did_change; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
996 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
997 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
998 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
999 /* |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1000 * Set the cterm foreground color for the Normal highlight group to "color" and |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1001 * the bold attribute to "bold". |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1002 */ |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1003 static void |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1004 hl_set_ctermfg_normal_group(int color, int bold) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1005 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1006 cterm_normal_fg_color = color + 1; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1007 cterm_normal_fg_bold = bold; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1008 #ifdef FEAT_GUI |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1009 // Don't do this if the GUI is used. |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1010 if (!gui.in_use && !gui.starting) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1011 #endif |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1012 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1013 set_must_redraw(UPD_CLEAR); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1014 if (termcap_active && color >= 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1015 term_fg_color(color); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1016 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1017 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1018 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1019 /* |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1020 * Set the cterm foreground color for the highlight group at 'idx' to 'color'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1021 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1022 static void |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1023 highlight_set_ctermfg(int idx, int color, int is_normal_group) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1024 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1025 HL_TABLE()[idx].sg_cterm_fg = color + 1; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1026 if (is_normal_group) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1027 hl_set_ctermfg_normal_group(color, |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1028 (HL_TABLE()[idx].sg_cterm & HL_BOLD)); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1029 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1030 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1031 /* |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1032 * Set the cterm background color for the Normal highlight group to "color". |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1033 */ |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1034 static void |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1035 hl_set_ctermbg_normal_group(int color) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1036 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1037 cterm_normal_bg_color = color + 1; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1038 #ifdef FEAT_GUI |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1039 // Don't mess with 'background' if the GUI is used. |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1040 if (!gui.in_use && !gui.starting) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1041 #endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1042 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1043 set_must_redraw(UPD_CLEAR); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1044 if (color >= 0) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1045 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1046 int dark = -1; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1047 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1048 if (termcap_active) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1049 term_bg_color(color); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1050 if (t_colors < 16) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1051 dark = (color == 0 || color == 4); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1052 // Limit the heuristic to the standard 16 colors |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1053 else if (color < 16) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1054 dark = (color < 7 || color == 8); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1055 // Set the 'background' option if the value is |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1056 // wrong. |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1057 if (dark != -1 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1058 && dark != (*p_bg == 'd') |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1059 && !option_was_set((char_u *)"bg")) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1060 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1061 set_option_value_give_err((char_u *)"bg", |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1062 0L, (char_u *)(dark ? "dark" : "light"), 0); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1063 reset_option_was_set((char_u *)"bg"); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1064 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1065 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1066 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1067 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1068 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1069 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1070 * Set the cterm background color for the highlight group at 'idx' to 'color'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1071 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1072 static void |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1073 highlight_set_ctermbg(int idx, int color, int is_normal_group) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1074 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1075 HL_TABLE()[idx].sg_cterm_bg = color + 1; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1076 if (is_normal_group) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1077 hl_set_ctermbg_normal_group(color); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1078 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1079 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1080 /* |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1081 * Set the cterm underline color for the Normal highlight group to "color". |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1082 */ |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1083 static void |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1084 hl_set_ctermul_normal_group(int color) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1085 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1086 cterm_normal_ul_color = color + 1; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1087 #ifdef FEAT_GUI |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1088 // Don't do this if the GUI is used. |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1089 if (!gui.in_use && !gui.starting) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1090 #endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1091 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1092 set_must_redraw(UPD_CLEAR); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1093 if (termcap_active && color >= 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1094 term_ul_color(color); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1095 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1096 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1097 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1098 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1099 * Set the cterm underline color for the highlight group at 'idx' to 'color'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1100 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1101 static void |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1102 highlight_set_ctermul(int idx, int color, int is_normal_group) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1103 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1104 HL_TABLE()[idx].sg_cterm_ul = color + 1; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1105 if (is_normal_group) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1106 hl_set_ctermul_normal_group(color); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1107 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1108 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1109 /* |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1110 * Set the cterm font for the highlight group at 'idx'. |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1111 * 'arg' is the color name or the numeric value as a string. |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1112 * 'init' is set to TRUE when initializing highlighting. |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1113 * Called for the ":highlight" command and the "hlset()" function. |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1114 * |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1115 * Returns TRUE if the font is set. |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1116 */ |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1117 static int |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1118 highlight_set_cterm_font( |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1119 int idx, |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1120 char_u *arg, |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1121 int init) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1122 { |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1123 int font; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1124 |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1125 if (init && (HL_TABLE()[idx].sg_set & SG_CTERM)) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1126 return FALSE; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1127 |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1128 if (!init) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1129 HL_TABLE()[idx].sg_set |= SG_CTERM; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1130 |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1131 if (VIM_ISDIGIT(*arg)) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1132 font = atoi((char *)arg); |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1133 else if (STRICMP(arg, "NONE") == 0) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1134 font = -1; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1135 else |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1136 return FALSE; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1137 |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1138 HL_TABLE()[idx].sg_cterm_font = font + 1; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1139 return TRUE; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1140 } |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1141 |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1142 /* |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1143 * Set the cterm fg/bg/ul color for the highlight group at 'idx'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1144 * 'key' is one of 'CTERMFG' or 'CTERMBG' or 'CTERMUL'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1145 * 'keystart' is the color name/value. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1146 * 'arg' is the color name or the numeric value as a string. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1147 * 'is_normal_group' is set if the highlight group is 'NORMAL' |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1148 * 'init' is set to TRUE when initializing highlighting. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1149 * Called for the ":highlight" command and the "hlset()" function. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1150 * |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1151 * Returns TRUE if the color is set. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1152 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1153 static int |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1154 highlight_set_cterm_color( |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1155 int idx, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1156 char_u *key, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1157 char_u *key_start, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1158 char_u *arg, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1159 int is_normal_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1160 int init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1161 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1162 int color; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1163 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1164 if (init && (HL_TABLE()[idx].sg_set & SG_CTERM)) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1165 return FALSE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1166 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1167 if (!init) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1168 HL_TABLE()[idx].sg_set |= SG_CTERM; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1169 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1170 // When setting the foreground color, and previously the "bold" |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1171 // flag was set for a light color, reset it now |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1172 if (key[5] == 'F' && HL_TABLE()[idx].sg_cterm_bold) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1173 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1174 HL_TABLE()[idx].sg_cterm &= ~HL_BOLD; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1175 HL_TABLE()[idx].sg_cterm_bold = FALSE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1176 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1177 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1178 if (VIM_ISDIGIT(*arg)) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1179 color = atoi((char *)arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1180 else if (STRICMP(arg, "fg") == 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1181 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1182 if (cterm_normal_fg_color) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1183 color = cterm_normal_fg_color - 1; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1184 else |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1185 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1186 emsg(_(e_fg_color_unknown)); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1187 return FALSE; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1188 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1189 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1190 else if (STRICMP(arg, "bg") == 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1191 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1192 if (cterm_normal_bg_color > 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1193 color = cterm_normal_bg_color - 1; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1194 else |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1195 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1196 emsg(_(e_bg_color_unknown)); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1197 return FALSE; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1198 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1199 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1200 else if (STRICMP(arg, "ul") == 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1201 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1202 if (cterm_normal_ul_color > 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1203 color = cterm_normal_ul_color - 1; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1204 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1205 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1206 emsg(_(e_ul_color_unknown)); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1207 return FALSE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1208 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1209 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1210 else |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1211 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1212 int bold = MAYBE; |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
1213 keyvalue_T target; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
1214 keyvalue_T *entry; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
1215 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
1216 target.key = 0; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
1217 target.value = (char *)arg; |
36081
f36c3455e686
patch 9.1.0709: GUIEnter event not found in Turkish locale
Christian Brabandt <cb@256bit.org>
parents:
35764
diff
changeset
|
1218 target.length = 0; // not used, see cmp_keyvalue_value_ni() |
f36c3455e686
patch 9.1.0709: GUIEnter event not found in Turkish locale
Christian Brabandt <cb@256bit.org>
parents:
35764
diff
changeset
|
1219 entry = (keyvalue_T *)bsearch(&target, &color_name_tab, ARRAY_LENGTH(color_name_tab), sizeof(color_name_tab[0]), cmp_keyvalue_value_ni); |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
1220 if (entry == NULL) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1221 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1222 semsg(_(e_color_name_or_number_not_recognized_str), key_start); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1223 return FALSE; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1224 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1225 |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
1226 color = lookup_color(entry->key, key[5] == 'F', &bold); |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1227 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1228 // set/reset bold attribute to get light foreground |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1229 // colors (on some terminals, e.g. "linux") |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1230 if (bold == TRUE) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1231 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1232 HL_TABLE()[idx].sg_cterm |= HL_BOLD; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1233 HL_TABLE()[idx].sg_cterm_bold = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1234 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1235 else if (bold == FALSE) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1236 HL_TABLE()[idx].sg_cterm &= ~HL_BOLD; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1237 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1238 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1239 // Add one to the argument, to avoid zero. Zero is used for |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1240 // "NONE", then "color" is -1. |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1241 if (key[5] == 'F') |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1242 highlight_set_ctermfg(idx, color, is_normal_group); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1243 else if (key[5] == 'B') |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1244 highlight_set_ctermbg(idx, color, is_normal_group); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1245 else // ctermul |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1246 highlight_set_ctermul(idx, color, is_normal_group); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1247 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1248 return TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1249 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1250 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1251 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1252 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1253 * Set the GUI foreground color for the highlight group at 'idx'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1254 * Returns TRUE if the color is set. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1255 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1256 static int |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1257 highlight_set_guifg( |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1258 int idx, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1259 char_u *arg, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1260 int is_menu_group UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1261 int is_scrollbar_group UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1262 int is_tooltip_group UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1263 int *do_colors UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1264 int init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1265 { |
26014
09a273f0af05
patch 8.2.3541: compiler warning for unused variable in tiny version
Bram Moolenaar <Bram@vim.org>
parents:
26009
diff
changeset
|
1266 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1267 long i; |
26014
09a273f0af05
patch 8.2.3541: compiler warning for unused variable in tiny version
Bram Moolenaar <Bram@vim.org>
parents:
26009
diff
changeset
|
1268 # endif |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1269 char_u **namep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1270 int did_change = FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1271 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1272 if (init && (HL_TABLE()[idx].sg_set & SG_GUI)) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1273 return FALSE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1274 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1275 namep = &HL_TABLE()[idx].sg_gui_fg_name; |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1276 if (!init) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1277 HL_TABLE()[idx].sg_set |= SG_GUI; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1278 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1279 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1280 // In GUI guifg colors are only used when recognized |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1281 i = color_name2handle(arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1282 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1283 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1284 HL_TABLE()[idx].sg_gui_fg = i; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1285 # endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1286 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1287 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1288 vim_free(*namep); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1289 if (STRCMP(arg, "NONE") != 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1290 *namep = vim_strsave(arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1291 else |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1292 *namep = NULL; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1293 did_change = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1294 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1295 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1296 # ifdef FEAT_GUI_X11 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1297 if (is_menu_group && gui.menu_fg_pixel != i) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1298 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1299 gui.menu_fg_pixel = i; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1300 *do_colors = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1301 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1302 if (is_scrollbar_group && gui.scroll_fg_pixel != i) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1303 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1304 gui.scroll_fg_pixel = i; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1305 *do_colors = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1306 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1307 # ifdef FEAT_BEVAL_GUI |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1308 if (is_tooltip_group && gui.tooltip_fg_pixel != i) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1309 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1310 gui.tooltip_fg_pixel = i; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1311 *do_colors = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1312 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1313 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1314 # endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1315 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1316 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1317 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1318 return did_change; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1319 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1320 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1321 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1322 * Set the GUI background color for the highlight group at 'idx'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1323 * Returns TRUE if the color is set. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1324 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1325 static int |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1326 highlight_set_guibg( |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1327 int idx, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1328 char_u *arg, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1329 int is_menu_group UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1330 int is_scrollbar_group UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1331 int is_tooltip_group UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1332 int *do_colors UNUSED, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1333 int init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1334 { |
26014
09a273f0af05
patch 8.2.3541: compiler warning for unused variable in tiny version
Bram Moolenaar <Bram@vim.org>
parents:
26009
diff
changeset
|
1335 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1336 int i; |
26014
09a273f0af05
patch 8.2.3541: compiler warning for unused variable in tiny version
Bram Moolenaar <Bram@vim.org>
parents:
26009
diff
changeset
|
1337 # endif |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1338 char_u **namep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1339 int did_change = FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1340 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1341 if (init && (HL_TABLE()[idx].sg_set & SG_GUI)) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1342 return FALSE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1343 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1344 namep = &HL_TABLE()[idx].sg_gui_bg_name; |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1345 if (!init) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1346 HL_TABLE()[idx].sg_set |= SG_GUI; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1347 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1348 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1349 // In GUI guibg colors are only used when recognized |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1350 i = color_name2handle(arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1351 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1352 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1353 HL_TABLE()[idx].sg_gui_bg = i; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1354 # endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1355 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1356 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1357 vim_free(*namep); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1358 if (STRCMP(arg, "NONE") != 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1359 *namep = vim_strsave(arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1360 else |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1361 *namep = NULL; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1362 did_change = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1363 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1364 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1365 # ifdef FEAT_GUI_X11 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1366 if (is_menu_group && gui.menu_bg_pixel != i) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1367 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1368 gui.menu_bg_pixel = i; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1369 *do_colors = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1370 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1371 if (is_scrollbar_group && gui.scroll_bg_pixel != i) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1372 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1373 gui.scroll_bg_pixel = i; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1374 *do_colors = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1375 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1376 # ifdef FEAT_BEVAL_GUI |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1377 if (is_tooltip_group && gui.tooltip_bg_pixel != i) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1378 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1379 gui.tooltip_bg_pixel = i; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1380 *do_colors = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1381 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1382 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1383 # endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1384 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1385 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1386 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1387 return did_change; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1388 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1389 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1390 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1391 * Set the GUI undercurl/strikethrough color for the highlight group at 'idx'. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1392 * Returns TRUE if the color is set. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1393 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1394 static int |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1395 highlight_set_guisp(int idx, char_u *arg, int init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1396 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1397 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1398 int i; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1399 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1400 int did_change = FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1401 char_u **namep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1402 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1403 if (init && (HL_TABLE()[idx].sg_set & SG_GUI)) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1404 return FALSE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1405 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1406 namep = &HL_TABLE()[idx].sg_gui_sp_name; |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1407 if (!init) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1408 HL_TABLE()[idx].sg_set |= SG_GUI; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1409 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1410 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1411 // In GUI guisp colors are only used when recognized |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1412 i = color_name2handle(arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1413 if (i != INVALCOLOR || STRCMP(arg, "NONE") == 0 || !USE_24BIT) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1414 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1415 HL_TABLE()[idx].sg_gui_sp = i; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1416 # endif |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1417 if (*namep == NULL || STRCMP(*namep, arg) != 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1418 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1419 vim_free(*namep); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1420 if (STRCMP(arg, "NONE") != 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1421 *namep = vim_strsave(arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1422 else |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1423 *namep = NULL; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1424 did_change = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1425 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1426 # if defined(FEAT_GUI) || defined(FEAT_TERMGUICOLORS) |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
1427 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1428 # endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1429 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1430 return did_change; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1431 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1432 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1433 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1434 /* |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1435 * Set the start/stop terminal codes for a highlight group. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1436 * Returns TRUE if the terminal code is set. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1437 */ |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1438 static int |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1439 highlight_set_startstop_termcode(int idx, char_u *key, char_u *arg, int init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1440 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1441 int off; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1442 char_u buf[100]; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1443 int len; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1444 char_u *tname; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1445 char_u *p; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1446 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1447 if (!init) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1448 HL_TABLE()[idx].sg_set |= SG_TERM; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1449 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1450 // The "start" and "stop" arguments can be a literal escape |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1451 // sequence, or a comma separated list of terminal codes. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1452 if (STRNCMP(arg, "t_", 2) == 0) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1453 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1454 off = 0; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1455 buf[0] = 0; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1456 while (arg[off] != NUL) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1457 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1458 // Isolate one termcap name |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1459 for (len = 0; arg[off + len] && |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1460 arg[off + len] != ','; ++len) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1461 ; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1462 tname = vim_strnsave(arg + off, len); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1463 if (tname == NULL) // out of memory |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1464 return FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1465 // lookup the escape sequence for the item |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1466 p = get_term_code(tname); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1467 vim_free(tname); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1468 if (p == NULL) // ignore non-existing things |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1469 p = (char_u *)""; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1470 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1471 // Append it to the already found stuff |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1472 if ((int)(STRLEN(buf) + STRLEN(p)) >= 99) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1473 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1474 semsg(_(e_terminal_code_too_long_str), arg); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1475 return FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1476 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1477 STRCAT(buf, p); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1478 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1479 // Advance to the next item |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1480 off += len; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1481 if (arg[off] == ',') // another one follows |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1482 ++off; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1483 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1484 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1485 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1486 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1487 // Copy characters from arg[] to buf[], translating <> codes. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1488 for (p = arg, off = 0; off < 100 - 6 && *p; ) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1489 { |
28668
53c608c7ea9e
patch 8.2.4858: K_SPECIAL may be escaped twice
Bram Moolenaar <Bram@vim.org>
parents:
28457
diff
changeset
|
1490 len = trans_special(&p, buf + off, FSK_SIMPLIFY, FALSE, NULL); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1491 if (len > 0) // recognized special char |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1492 off += len; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1493 else // copy as normal char |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1494 buf[off++] = *p++; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1495 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1496 buf[off] = NUL; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1497 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1498 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1499 if (STRCMP(buf, "NONE") == 0) // resetting the value |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1500 p = NULL; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1501 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1502 p = vim_strsave(buf); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1503 if (key[2] == 'A') |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1504 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1505 vim_free(HL_TABLE()[idx].sg_start); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1506 HL_TABLE()[idx].sg_start = p; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1507 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1508 else |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1509 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1510 vim_free(HL_TABLE()[idx].sg_stop); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1511 HL_TABLE()[idx].sg_stop = p; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1512 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1513 return TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1514 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1515 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1516 /* |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1517 * 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
|
1518 * 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
|
1519 * "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
|
1520 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1521 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1522 do_highlight( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1523 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
|
1524 int forceit, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1525 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
|
1526 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1527 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
|
1528 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
|
1529 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
|
1530 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
|
1531 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
|
1532 long i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1533 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1534 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1535 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
|
1536 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
|
1537 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
|
1538 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
|
1539 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
|
1540 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
|
1541 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
|
1542 #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
|
1543 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
|
1544 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
|
1545 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
|
1546 #else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1547 # 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
|
1548 # define is_tooltip_group 0 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1549 # define is_scrollbar_group 0 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1550 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1551 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1552 int do_colors = FALSE; // need to update colors? |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1553 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1554 #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
|
1555 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
|
1556 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1557 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1558 // If no argument, list current highlighting. |
20113
2c23053c654a
patch 8.2.0612: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20007
diff
changeset
|
1559 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
|
1560 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1561 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
|
1562 // 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
|
1563 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
|
1564 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1565 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1566 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1567 // Isolate the name. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1568 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
|
1569 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
|
1570 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1571 // Check for "default" argument. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1572 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
|
1573 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1574 dodefault = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1575 line = linep; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1576 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
|
1577 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
|
1578 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1579 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1580 // Check for "clear" or "link" argument. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1581 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
|
1582 doclear = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1583 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
|
1584 dolink = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1585 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1586 // ":highlight {group-name}": list highlighting for one group. |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
1587 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
|
1588 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1589 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
|
1590 if (id == 0) |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1591 semsg(_(e_highlight_group_name_not_found_str), line); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1592 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1593 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
|
1594 return; |
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 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1597 // Handle ":highlight link {from} {to}" command. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1598 if (dolink) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1599 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1600 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
|
1601 char_u *from_end; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1602 int from_len; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1603 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
|
1604 char_u *to_end; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1605 int to_len; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1606 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1607 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
|
1608 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
|
1609 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
|
1610 |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
1611 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
|
1612 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1613 semsg(_(e_not_enough_arguments_highlight_link_str), from_start); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1614 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1615 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1616 |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
1617 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
|
1618 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1619 semsg(_(e_too_many_arguments_highlight_link_str), from_start); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1620 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1621 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1622 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1623 from_len = (int)(from_end - from_start); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1624 to_len = (int)(to_end - to_start); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1625 highlight_group_link(from_start, from_len, to_start, to_len, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1626 dodefault, forceit, init); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1627 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1628 } |
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 if (doclear) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1631 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1632 // ":highlight clear [group]" command. |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
1633 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
|
1634 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1635 // ":highlight clear" without group name |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1636 highlight_reset_all(); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1637 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1638 } |
20116
513c62184ed8
patch 8.2.0613: Vim9: no check for space before #comment
Bram Moolenaar <Bram@vim.org>
parents:
20113
diff
changeset
|
1639 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
|
1640 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
|
1641 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
|
1642 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1643 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1644 // Find the group name in the table. If it does not exist yet, add it. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1645 id = syn_check_group(line, (int)(name_end - line)); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1646 if (id == 0) // failed (out of memory) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1647 return; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1648 idx = id - 1; // index is ID minus one |
17389
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 // 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
|
1651 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
|
1652 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1653 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1654 // 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
|
1655 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
|
1656 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1657 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
|
1658 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
|
1659 #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
|
1660 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
|
1661 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
|
1662 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
|
1663 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
|
1664 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
|
1665 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
|
1666 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1667 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1668 // 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
|
1669 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
|
1670 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1671 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
|
1672 if (!doclear) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1673 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
|
1674 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1675 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1676 if (!doclear) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1677 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
|
1678 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1679 key_start = linep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1680 if (*linep == '=') |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1681 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1682 semsg(_(e_unexpected_equal_sign_str), key_start); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1683 error = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1684 break; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1685 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1686 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1687 // Isolate the key ("term", "ctermfg", "ctermbg", "font", "guifg" |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1688 // or "guibg"). |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1689 while (*linep && !VIM_ISWHITE(*linep) && *linep != '=') |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1690 ++linep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1691 vim_free(key); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1692 key = vim_strnsave_up(key_start, linep - key_start); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1693 if (key == NULL) |
17389
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 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1696 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1697 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1698 linep = skipwhite(linep); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1699 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1700 if (STRCMP(key, "NONE") == 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1701 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1702 if (!init || HL_TABLE()[idx].sg_set == 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1703 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1704 if (!init) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1705 HL_TABLE()[idx].sg_set |= SG_TERM+SG_CTERM+SG_GUI; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1706 highlight_clear(idx); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1707 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1708 continue; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1709 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1710 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1711 // Check for the equal sign. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1712 if (*linep != '=') |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1713 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1714 semsg(_(e_missing_equal_sign_str_2), key_start); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1715 error = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1716 break; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1717 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1718 ++linep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1719 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1720 // Isolate the argument. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1721 linep = skipwhite(linep); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1722 if (*linep == '\'') // guifg='color name' |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1723 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1724 arg_start = ++linep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1725 linep = vim_strchr(linep, '\''); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1726 if (linep == NULL) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1727 { |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26454
diff
changeset
|
1728 semsg(_(e_invalid_argument_str), key_start); |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1729 error = TRUE; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1730 break; |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1731 } |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1732 } |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1733 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1734 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1735 arg_start = linep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1736 linep = skiptowhite(linep); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1737 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1738 if (linep == arg_start) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1739 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1740 semsg(_(e_missing_argument_str), key_start); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1741 error = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1742 break; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1743 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1744 vim_free(arg); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1745 arg = vim_strnsave(arg_start, linep - arg_start); |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1746 if (arg == NULL) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1747 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1748 error = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1749 break; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1750 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1751 if (*linep == '\'') |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1752 ++linep; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1753 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1754 // Store the argument. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1755 if (STRCMP(key, "TERM") == 0 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1756 || STRCMP(key, "CTERM") == 0 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1757 || STRCMP(key, "GUI") == 0) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1758 { |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1759 if (!highlight_set_termgui_attr(idx, key, arg, init)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1760 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1761 error = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1762 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1763 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1764 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1765 else if (STRCMP(key, "FONT") == 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1766 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1767 // in non-GUI fonts are simply ignored |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1768 #ifdef FEAT_GUI |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1769 if (highlight_set_font(idx, arg, is_normal_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1770 is_menu_group, is_tooltip_group)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1771 did_change = TRUE; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1772 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1773 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1774 else if (STRCMP(key, "CTERMFG") == 0 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1775 || STRCMP(key, "CTERMBG") == 0 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1776 || STRCMP(key, "CTERMUL") == 0) |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1777 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1778 if (!highlight_set_cterm_color(idx, key, key_start, arg, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1779 is_normal_group, init)) |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1780 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1781 error = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1782 break; |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1783 } |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20603
diff
changeset
|
1784 } |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1785 else if (STRCMP(key, "CTERMFONT") == 0) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1786 { |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1787 if (!highlight_set_cterm_font(idx, arg, init)) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1788 { |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1789 error = TRUE; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1790 break; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1791 } |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1792 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1793 else if (STRCMP(key, "GUIFG") == 0) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1794 { |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1795 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1796 if (highlight_set_guifg(idx, arg, is_menu_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1797 is_scrollbar_group, is_tooltip_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1798 &do_colors, init)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1799 did_change = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1800 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1801 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1802 else if (STRCMP(key, "GUIBG") == 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1803 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1804 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1805 if (highlight_set_guibg(idx, arg, is_menu_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1806 is_scrollbar_group, is_tooltip_group, |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1807 &do_colors, init)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1808 did_change = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1809 #endif |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1810 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1811 else if (STRCMP(key, "GUISP") == 0) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1812 { |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1813 #if defined(FEAT_GUI) || defined(FEAT_EVAL) |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1814 if (highlight_set_guisp(idx, arg, init)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1815 did_change = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1816 #endif |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1817 } |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1818 else if (STRCMP(key, "START") == 0 || STRCMP(key, "STOP") == 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1819 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1820 if (!highlight_set_startstop_termcode(idx, key, arg, init)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1821 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1822 error = TRUE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1823 break; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1824 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1825 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1826 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1827 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
1828 semsg(_(e_illegal_argument_str_3), key_start); |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1829 error = TRUE; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1830 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1831 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1832 HL_TABLE()[idx].sg_cleared = FALSE; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1833 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1834 // When highlighting has been given for a group, don't link it. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1835 if (!init || !(HL_TABLE()[idx].sg_set & SG_LINK)) |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1836 HL_TABLE()[idx].sg_link = 0; |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1837 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1838 // Continue with next argument. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1839 linep = skipwhite(linep); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1840 } |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1841 |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1842 // If there is an error, and it's a new entry, remove it from the table. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1843 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
|
1844 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
|
1845 else |
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 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
|
1848 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1849 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
|
1850 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
|
1851 #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
|
1852 HL_TABLE()[idx].sg_gui_attr = 0; |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1853 // Need to update all groups, because they might be using "bg" |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
1854 // and/or "fg", which have been changed now. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1855 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1856 #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
|
1857 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
|
1858 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1859 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
|
1860 did_highlight_changed = TRUE; |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29726
diff
changeset
|
1861 redraw_all_later(UPD_NOT_VALID); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1862 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1863 #endif |
19756
fe90a71a3fed
patch 8.2.0434: MS-Windows with VTP: Normal color not working
Bram Moolenaar <Bram@vim.org>
parents:
19265
diff
changeset
|
1864 #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
|
1865 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
|
1866 #endif |
17389
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 #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
|
1869 # 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
|
1870 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
|
1871 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1872 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
|
1873 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
|
1874 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1875 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1876 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
|
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 (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
|
1879 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
|
1880 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1881 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
|
1882 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1883 # 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
|
1884 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
|
1885 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1886 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
|
1887 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
|
1888 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1889 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1890 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1891 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1892 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
|
1893 #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
|
1894 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
|
1895 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
|
1896 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1897 } |
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 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
|
1900 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
|
1901 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1902 // 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
|
1903 // 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
|
1904 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
|
1905 || 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
|
1906 #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
|
1907 && !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
|
1908 #endif |
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 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1911 // 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
|
1912 // 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
|
1913 // StatusLine group. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1914 if (!updating_screen) |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29726
diff
changeset
|
1915 redraw_all_later(UPD_NOT_VALID); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1916 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
|
1917 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1918 } |
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 #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
|
1921 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1922 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
|
1923 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1924 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1925 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1926 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
|
1927 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1928 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
|
1929 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
|
1930 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
|
1931 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1932 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
|
1933 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1934 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1935 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1936 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1937 * 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
|
1938 * 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
|
1939 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1940 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1941 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
|
1942 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1943 #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
|
1944 // 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
|
1945 // 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
|
1946 // 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
|
1947 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
|
1948 #else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1949 # ifdef VIMDLL |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1950 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
|
1951 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1952 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
|
1953 return; |
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 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1956 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
|
1957 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
|
1958 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
|
1959 # 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
|
1960 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
|
1961 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
|
1962 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
|
1963 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1964 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1965 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1966 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1967 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1968 * 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
|
1969 * 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
|
1970 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1971 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1972 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
|
1973 { |
22288
a9ff3e0d6d54
patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents:
21054
diff
changeset
|
1974 return HL_TABLE()[idx].sg_cleared == 0 |
a9ff3e0d6d54
patch 8.2.1693: "hi def" does not work for cleared highlight
Bram Moolenaar <Bram@vim.org>
parents:
21054
diff
changeset
|
1975 && ( HL_TABLE()[idx].sg_term_attr != 0 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1976 || 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
|
1977 || 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
|
1978 || HL_TABLE()[idx].sg_cterm_bg != 0 |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
1979 || HL_TABLE()[idx].sg_cterm_font != 0 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1980 #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
|
1981 || 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
|
1982 || 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
|
1983 || 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
|
1984 || 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
|
1985 || 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
|
1986 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1987 || (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
|
1988 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1989 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1990 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1991 * 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
|
1992 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1993 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1994 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
|
1995 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1996 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
|
1997 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
1998 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
|
1999 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
|
2000 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
|
2001 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
|
2002 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
|
2003 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
|
2004 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
|
2005 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
|
2006 HL_TABLE()[idx].sg_cterm_attr = 0; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
2007 HL_TABLE()[idx].sg_cterm_font = 0; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2008 #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
|
2009 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
|
2010 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
|
2011 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
|
2012 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
|
2013 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2014 #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
|
2015 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
|
2016 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
|
2017 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
|
2018 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2019 #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
|
2020 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
|
2021 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
|
2022 # 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
|
2023 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
|
2024 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
|
2025 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2026 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
|
2027 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
|
2028 #endif |
22312
e06ba60fbbd8
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents:
22308
diff
changeset
|
2029 // Restore default link and context if they exist. Otherwise clears. |
22308
19e0784ef769
patch 8.2.1703: ":highlight clear" does not restore default link
Bram Moolenaar <Bram@vim.org>
parents:
22288
diff
changeset
|
2030 HL_TABLE()[idx].sg_link = HL_TABLE()[idx].sg_deflink; |
22312
e06ba60fbbd8
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents:
22308
diff
changeset
|
2031 #ifdef FEAT_EVAL |
e06ba60fbbd8
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents:
22308
diff
changeset
|
2032 // Since we set the default link, set the location to where the default |
e06ba60fbbd8
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents:
22308
diff
changeset
|
2033 // link was set. |
e06ba60fbbd8
patch 8.2.1705: "verbose hi Name" reports incorrect info after ":hi clear"
Bram Moolenaar <Bram@vim.org>
parents:
22308
diff
changeset
|
2034 HL_TABLE()[idx].sg_script_ctx = HL_TABLE()[idx].sg_deflink_sctx; |
17389
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 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2038 #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
|
2039 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2040 * 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
|
2041 * 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
|
2042 * "Tooltip" colors. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2043 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2044 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2045 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
|
2046 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2047 # 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
|
2048 # 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
|
2049 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
|
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 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
|
2053 &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
|
2054 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
|
2055 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2056 gui_mch_new_colors(); |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
2057 set_must_redraw(UPD_CLEAR); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2058 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2059 # 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
|
2060 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
|
2061 &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
|
2062 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
|
2063 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2064 # 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
|
2065 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
|
2066 # endif |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
2067 set_must_redraw(UPD_CLEAR); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2068 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2069 # 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
|
2070 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
|
2071 &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
|
2072 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
|
2073 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2074 # 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
|
2075 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
|
2076 # endif |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
2077 set_must_redraw(UPD_CLEAR); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2078 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2079 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2080 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
|
2081 &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
|
2082 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
|
2083 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2084 gui_new_scrollbar_colors(); |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
2085 set_must_redraw(UPD_CLEAR); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2086 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2087 # endif |
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 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2090 # 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
|
2091 # 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
|
2092 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2093 # endif |
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 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2096 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2097 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
|
2098 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
|
2099 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2100 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
|
2101 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2102 // 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
|
2103 // required. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2104 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
|
2105 || 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
|
2106 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2107 // 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
|
2108 // color |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2109 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
|
2110 cterm_normal_bg_gui_color = HL_TABLE()[idx].sg_gui_bg; |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
2111 set_must_redraw(UPD_CLEAR); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2112 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2113 } |
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 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2116 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2117 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2118 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2119 #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
|
2120 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2121 * 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
|
2122 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2123 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2124 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
|
2125 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
|
2126 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
|
2127 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
|
2128 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
|
2129 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
|
2130 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
|
2131 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2132 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2133 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2134 idx = syn_name2id(name) - 1; |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2135 if (idx < 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2136 return FALSE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2137 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2138 gui_do_one_color(idx, do_menu, do_tooltip); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2139 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2140 if (HL_TABLE()[idx].sg_gui_fg != INVALCOLOR) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2141 *fgp = HL_TABLE()[idx].sg_gui_fg; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2142 else if (use_norm) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2143 *fgp = gui.def_norm_pixel; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2144 if (HL_TABLE()[idx].sg_gui_bg != INVALCOLOR) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2145 *bgp = HL_TABLE()[idx].sg_gui_bg; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2146 else if (use_norm) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2147 *bgp = gui.def_back_pixel; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2148 return TRUE; |
17389
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 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2152 * 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
|
2153 * 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
|
2154 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2155 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2156 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
|
2157 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2158 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2159 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
|
2160 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2161 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
|
2162 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
|
2163 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2164 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
|
2165 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
|
2166 return s; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2167 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2168 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
|
2169 } |
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 * 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
|
2173 * 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
|
2174 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2175 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2176 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
|
2177 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2178 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2179 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2180 id = syn_name2id((char_u *)"Normal"); |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2181 if (id <= 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2182 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2183 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2184 vim_free(HL_TABLE()[id - 1].sg_font_name); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2185 HL_TABLE()[id - 1].sg_font_name = vim_strsave(font_name); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2186 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2187 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2188 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2189 * 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
|
2190 * 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
|
2191 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2192 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2193 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
|
2194 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
|
2195 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2196 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2197 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2198 if (name == NULL) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2199 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2200 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2201 id = syn_name2id((char_u *)"Normal"); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2202 if (id <= 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2203 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2204 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2205 vim_free(HL_TABLE()[id - 1].sg_gui_bg_name); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2206 HL_TABLE()[id - 1].sg_gui_bg_name = name; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2207 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2208 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2209 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2210 * 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
|
2211 * 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
|
2212 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2213 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2214 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
|
2215 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
|
2216 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2217 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2218 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2219 if (name == NULL) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2220 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2221 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2222 id = syn_name2id((char_u *)"Normal"); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2223 if (id <= 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2224 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2225 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2226 vim_free(HL_TABLE()[id - 1].sg_gui_fg_name); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
2227 HL_TABLE()[id - 1].sg_gui_fg_name = name; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2228 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2229 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2230 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2231 * 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
|
2232 * 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
|
2233 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2234 static GuiFont |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2235 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
|
2236 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2237 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
|
2238 return NOFONT; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2239 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2240 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
|
2241 } |
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 # 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
|
2244 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2245 * 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
|
2246 * 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
|
2247 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2248 static GuiFontset |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2249 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
|
2250 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2251 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
|
2252 return NOFONTSET; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2253 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2254 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
|
2255 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2256 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2257 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2258 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2259 * 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
|
2260 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2261 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2262 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
|
2263 int idx, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2264 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
|
2265 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
|
2266 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
|
2267 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
|
2268 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
|
2269 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2270 # 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
|
2271 // 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
|
2272 // 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
|
2273 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
|
2274 # 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
|
2275 || do_menu |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2276 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2277 # ifdef FEAT_BEVAL_TIP |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
27752
diff
changeset
|
2278 // In Motif, the Tooltip highlight group is always a fontset |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2279 || do_tooltip |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2280 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2281 ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2282 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2283 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
|
2284 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
|
2285 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
|
2286 # 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
|
2287 || do_menu |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2288 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2289 # 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
|
2290 || do_tooltip |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2291 # endif |
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 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2294 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
|
2295 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2296 // 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
|
2297 // 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
|
2298 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
|
2299 gui_init_font(arg, TRUE); |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
27752
diff
changeset
|
2300 # if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2301 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
|
2302 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2303 # 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
|
2304 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
|
2305 # else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2306 // 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
|
2307 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
|
2308 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2309 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
|
2310 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2311 # 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
|
2312 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
|
2313 { |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
27752
diff
changeset
|
2314 // The Athena widget set could not handle switching between |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2315 // 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
|
2316 // 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
|
2317 // 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
|
2318 // 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
|
2319 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
|
2320 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
|
2321 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2322 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2323 # endif |
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 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2326 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2327 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2328 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
|
2329 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
|
2330 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
|
2331 // 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
|
2332 // 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
|
2333 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
|
2334 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2335 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
|
2336 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
|
2337 #ifndef FONTSET_ALWAYS |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
27752
diff
changeset
|
2338 # if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2339 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
|
2340 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2341 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
|
2342 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
|
2343 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2344 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2345 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2346 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2347 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2348 } |
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 #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
|
2351 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2352 #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
|
2353 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2354 * 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
|
2355 * 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
|
2356 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2357 guicolor_T |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2358 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
|
2359 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2360 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
|
2361 return INVALCOLOR; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2362 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2363 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
|
2364 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2365 #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
|
2366 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
|
2367 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2368 #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
|
2369 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
|
2370 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2371 #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
|
2372 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
|
2373 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
|
2374 // 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
|
2375 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
|
2376 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2377 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2378 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
|
2379 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2380 #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
|
2381 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
|
2382 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2383 #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
|
2384 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
|
2385 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2386 #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
|
2387 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
|
2388 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
|
2389 // 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
|
2390 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
|
2391 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2392 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2393 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2394 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
|
2395 } |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2396 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2397 // On MS-Windows an RGB macro is available and it produces 0x00bbggrr color |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2398 // values as used by the MS-Windows GDI api. It should be used only for |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2399 // MS-Windows GDI builds. |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2400 # if defined(RGB) && defined(MSWIN) && !defined(FEAT_GUI) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2401 # undef RGB |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2402 # endif |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2403 # ifndef RGB |
27752
c1d1639b52dd
patch 8.2.4402: missing parenthesis may cause unexpected problems
Bram Moolenaar <Bram@vim.org>
parents:
27032
diff
changeset
|
2404 # define RGB(r, g, b) (((r)<<16) | ((g)<<8) | (b)) |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2405 # endif |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2406 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2407 # ifdef VIMDLL |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2408 static guicolor_T |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2409 gui_adjust_rgb(guicolor_T c) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2410 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2411 if (gui.in_use) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2412 return c; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2413 else |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2414 return ((c & 0xff) << 16) | (c & 0x00ff00) | ((c >> 16) & 0xff); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2415 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2416 # else |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2417 # define gui_adjust_rgb(c) (c) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2418 # endif |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2419 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2420 static int |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2421 hex_digit(int c) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2422 { |
34074
1629cc65d78d
patch 9.1.0006: is*() and to*() function may be unsafe
Christian Brabandt <cb@256bit.org>
parents:
33399
diff
changeset
|
2423 if (SAFE_isdigit(c)) |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2424 return c - '0'; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2425 c = TOLOWER_ASC(c); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2426 if (c >= 'a' && c <= 'f') |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2427 return c - 'a' + 10; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2428 return 0x1ffffff; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2429 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2430 |
27032
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
2431 static guicolor_T |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2432 decode_hex_color(char_u *hex) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2433 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2434 guicolor_T color; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2435 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2436 if (hex[0] != '#' || STRLEN(hex) != 7) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2437 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2438 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2439 // Name is in "#rrggbb" format |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2440 color = RGB(((hex_digit(hex[1]) << 4) + hex_digit(hex[2])), |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2441 ((hex_digit(hex[3]) << 4) + hex_digit(hex[4])), |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2442 ((hex_digit(hex[5]) << 4) + hex_digit(hex[6]))); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2443 if (color > 0xffffff) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2444 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2445 return gui_adjust_rgb(color); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2446 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2447 |
26059
c7e09c069ece
patch 8.2.3563: build failure with +eval but without GUI or +termguicolors
Bram Moolenaar <Bram@vim.org>
parents:
26057
diff
changeset
|
2448 #ifdef FEAT_EVAL |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2449 // Returns the color currently mapped to the given name or INVALCOLOR if no |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2450 // such name exists in the color table. The convention is to use lowercase for |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2451 // all keys in the v:colornames dictionary. The value can be either a string in |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2452 // the form #rrggbb or a number, either of which is converted to a guicolor_T. |
27032
18cafa092e8d
patch 8.2.4045: some global functions are only used in one file
Bram Moolenaar <Bram@vim.org>
parents:
27018
diff
changeset
|
2453 static guicolor_T |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2454 colorname2rgb(char_u *name) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2455 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2456 dict_T *colornames_table = get_vim_var_dict(VV_COLORNAMES); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2457 char_u *lc_name; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2458 dictitem_T *colentry; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2459 char_u *colstr; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2460 varnumber_T colnum; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2461 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2462 lc_name = strlow_save(name); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2463 if (lc_name == NULL) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2464 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2465 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2466 colentry = dict_find(colornames_table, lc_name, -1); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2467 vim_free(lc_name); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2468 if (colentry == NULL) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2469 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2470 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2471 if (colentry->di_tv.v_type == VAR_STRING) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2472 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2473 colstr = tv_get_string_strict(&colentry->di_tv); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2474 if ((STRLEN(colstr) == 7) && (*colstr == '#')) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2475 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2476 return decode_hex_color(colstr); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2477 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2478 else |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2479 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2480 semsg(_(e_bad_color_string_str), colstr); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2481 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2482 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2483 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2484 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2485 if (colentry->di_tv.v_type == VAR_NUMBER) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2486 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2487 colnum = tv_get_number(&colentry->di_tv); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2488 return (guicolor_T)colnum; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2489 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2490 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2491 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2492 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2493 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2494 #endif |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2495 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2496 guicolor_T |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2497 gui_get_color_cmn(char_u *name) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2498 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2499 guicolor_T color; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2500 // Only non X11 colors (not present in rgb.txt) and colors in |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2501 // color_name_tab[], useful when $VIMRUNTIME is not found,. |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2502 // must be sorted by the 'value' field because it is used by bsearch()! |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2503 static keyvalue_T rgb_tab[] = { |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2504 KEYVALUE_ENTRY(RGB(0x00, 0x00, 0x00), "black"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2505 KEYVALUE_ENTRY(RGB(0x00, 0x00, 0xFF), "blue"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2506 KEYVALUE_ENTRY(RGB(0xA5, 0x2A, 0x2A), "brown"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2507 KEYVALUE_ENTRY(RGB(0x00, 0xFF, 0xFF), "cyan"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2508 KEYVALUE_ENTRY(RGB(0x00, 0x00, 0x8B), "darkblue"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2509 KEYVALUE_ENTRY(RGB(0x00, 0x8B, 0x8B), "darkcyan"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2510 KEYVALUE_ENTRY(RGB(0xA9, 0xA9, 0xA9), "darkgray"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2511 KEYVALUE_ENTRY(RGB(0x00, 0x64, 0x00), "darkgreen"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2512 KEYVALUE_ENTRY(RGB(0xA9, 0xA9, 0xA9), "darkgrey"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2513 KEYVALUE_ENTRY(RGB(0x8B, 0x00, 0x8B), "darkmagenta"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2514 KEYVALUE_ENTRY(RGB(0x8B, 0x00, 0x00), "darkred"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2515 KEYVALUE_ENTRY(RGB(0x8B, 0x8B, 0x00), "darkyellow"), // No X11 |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2516 KEYVALUE_ENTRY(RGB(0xBE, 0xBE, 0xBE), "gray"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2517 KEYVALUE_ENTRY(RGB(0x00, 0xFF, 0x00), "green"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2518 KEYVALUE_ENTRY(RGB(0xBE, 0xBE, 0xBE), "grey"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2519 KEYVALUE_ENTRY(RGB(0x66, 0x66, 0x66), "grey40"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2520 KEYVALUE_ENTRY(RGB(0x7F, 0x7F, 0x7F), "grey50"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2521 KEYVALUE_ENTRY(RGB(0xE5, 0xE5, 0xE5), "grey90"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2522 KEYVALUE_ENTRY(RGB(0xAD, 0xD8, 0xE6), "lightblue"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2523 KEYVALUE_ENTRY(RGB(0xE0, 0xFF, 0xFF), "lightcyan"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2524 KEYVALUE_ENTRY(RGB(0xD3, 0xD3, 0xD3), "lightgray"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2525 KEYVALUE_ENTRY(RGB(0x90, 0xEE, 0x90), "lightgreen"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2526 KEYVALUE_ENTRY(RGB(0xD3, 0xD3, 0xD3), "lightgrey"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2527 KEYVALUE_ENTRY(RGB(0xFF, 0x8B, 0xFF), "lightmagenta"), // No XX |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2528 KEYVALUE_ENTRY(RGB(0xFF, 0x8B, 0x8B), "lightred"), // No XX |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2529 KEYVALUE_ENTRY(RGB(0xFF, 0xFF, 0xE0), "lightyellow"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2530 KEYVALUE_ENTRY(RGB(0xFF, 0x00, 0xFF), "magenta"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2531 KEYVALUE_ENTRY(RGB(0xFF, 0x00, 0x00), "red"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2532 KEYVALUE_ENTRY(RGB(0x2E, 0x8B, 0x57), "seagreen"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2533 KEYVALUE_ENTRY(RGB(0xFF, 0xFF, 0xFF), "white"), |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2534 KEYVALUE_ENTRY(RGB(0xFF, 0xFF, 0x00), "yellow") |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2535 }; |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2536 keyvalue_T target; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2537 keyvalue_T *entry; |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2538 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2539 color = decode_hex_color(name); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2540 if (color != INVALCOLOR) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2541 return color; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2542 |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2543 target.key = 0; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2544 target.value = (char *)name; |
36081
f36c3455e686
patch 9.1.0709: GUIEnter event not found in Turkish locale
Christian Brabandt <cb@256bit.org>
parents:
35764
diff
changeset
|
2545 target.length = 0; // not used, see cmp_keyvalue_value_ni() |
f36c3455e686
patch 9.1.0709: GUIEnter event not found in Turkish locale
Christian Brabandt <cb@256bit.org>
parents:
35764
diff
changeset
|
2546 entry = (keyvalue_T *)bsearch(&target, &rgb_tab, ARRAY_LENGTH(rgb_tab), sizeof(rgb_tab[0]), cmp_keyvalue_value_ni); |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2547 if (entry != NULL) |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
2548 return gui_adjust_rgb((guicolor_T)entry->key); |
26057
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2549 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2550 #if defined(FEAT_EVAL) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2551 /* |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2552 * Not a traditional color. Load additional color aliases and then consult the alias table. |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2553 */ |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2554 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2555 color = colorname2rgb(name); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2556 if (color == INVALCOLOR) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2557 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2558 load_default_colors_lists(); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2559 color = colorname2rgb(name); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2560 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2561 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2562 return color; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2563 #else |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2564 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2565 #endif |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2566 } |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2567 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2568 guicolor_T |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2569 gui_get_rgb_color_cmn(int r, int g, int b) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2570 { |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2571 guicolor_T color = RGB(r, g, b); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2572 |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2573 if (color > 0xffffff) |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2574 return INVALCOLOR; |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2575 return gui_adjust_rgb(color); |
92c424550367
patch 8.2.3562: cannot add color names
Bram Moolenaar <Bram@vim.org>
parents:
26014
diff
changeset
|
2576 } |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2577 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2578 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2579 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2580 * 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
|
2581 * 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
|
2582 * 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
|
2583 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2584 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
|
2585 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2586 #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
|
2587 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2588 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
|
2589 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2590 #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
|
2591 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2592 #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
|
2593 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
|
2594 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2595 #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
|
2596 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2597 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2598 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2599 * 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
|
2600 * 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
|
2601 * 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
|
2602 * 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
|
2603 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2604 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2605 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
|
2606 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2607 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2608 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
|
2609 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
|
2610 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
2611 // Init the table, in case it wasn't done yet. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2612 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
|
2613 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
|
2614 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
2615 // Try to find an entry with the same specifications. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2616 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
|
2617 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2618 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
|
2619 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
|
2620 && ( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2621 #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
|
2622 (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
|
2623 && (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
|
2624 && 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
|
2625 == 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
|
2626 && 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
|
2627 == 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
|
2628 && 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
|
2629 # 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
|
2630 && 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
|
2631 # endif |
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 || |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2634 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2635 (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
|
2636 && (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
|
2637 == (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
|
2638 && (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
|
2639 || 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
|
2640 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
|
2641 && (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
|
2642 == (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
|
2643 && (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
|
2644 || 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
|
2645 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
|
2646 || (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
|
2647 && 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
|
2648 == 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
|
2649 && 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
|
2650 == 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
|
2651 && 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
|
2652 == taep->ae_u.cterm.ul_color |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
2653 && aep->ae_u.cterm.font |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
2654 == taep->ae_u.cterm.font |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2655 #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
|
2656 && 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
|
2657 == 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
|
2658 && 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
|
2659 == 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
|
2660 && 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
|
2661 == 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
|
2662 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2663 ))) |
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 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
|
2666 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2667 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2668 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
|
2669 { |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
2670 // Running out of attribute entries! remove all attributes, and |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
2671 // compute new ones for all groups. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
2672 // When called recursively, we are really out of numbers. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2673 if (recursive) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2674 { |
26913
d4e61d61afd9
patch 8.2.3985: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26877
diff
changeset
|
2675 emsg(_(e_too_many_different_highlighting_attributes_in_use)); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2676 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2677 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2678 recursive = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2679 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2680 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
|
2681 |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
2682 set_must_redraw(UPD_CLEAR); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2683 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2684 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
|
2685 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
|
2686 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2687 recursive = FALSE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2688 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2689 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
2690 // This is a new combination of colors and font, add an entry. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2691 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
|
2692 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2693 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2694 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
|
2695 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
|
2696 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
|
2697 #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
|
2698 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
|
2699 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2700 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
|
2701 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
|
2702 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
|
2703 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
|
2704 # 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
|
2705 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
|
2706 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2707 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2708 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2709 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
|
2710 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2711 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
|
2712 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
|
2713 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2714 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
|
2715 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
|
2716 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
|
2717 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2718 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
|
2719 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2720 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
|
2721 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2722 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
|
2723 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
|
2724 taep->ae_u.cterm.ul_color = aep->ae_u.cterm.ul_color; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
2725 taep->ae_u.cterm.font = aep->ae_u.cterm.font; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2726 #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
|
2727 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
|
2728 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
|
2729 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
|
2730 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2731 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2732 ++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
|
2733 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
|
2734 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2735 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2736 #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
|
2737 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2738 * 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
|
2739 * 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
|
2740 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2741 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2742 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
|
2743 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2744 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
|
2745 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2746 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
|
2747 #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
|
2748 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
|
2749 at_en.ae_u.cterm.bg_rgb = INVALCOLOR; |
20673
0ebd431a2256
patch 8.2.0890: no color in terminal window when 'termguicolor' is set
Bram Moolenaar <Bram@vim.org>
parents:
20619
diff
changeset
|
2750 at_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
|
2751 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2752 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
|
2753 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
|
2754 at_en.ae_u.cterm.bg_color = bg; |
20675
02f648f1c8fa
patch 8.2.0891: clang warns for invalid conversion
Bram Moolenaar <Bram@vim.org>
parents:
20673
diff
changeset
|
2755 at_en.ae_u.cterm.ul_color = 0; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
2756 at_en.ae_u.cterm.font = 0; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2757 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
|
2758 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2759 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2760 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2761 #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
|
2762 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2763 * 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
|
2764 * 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
|
2765 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2766 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2767 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
|
2768 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2769 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
|
2770 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2771 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
|
2772 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
|
2773 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
|
2774 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2775 // 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
|
2776 // 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
|
2777 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
|
2778 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
|
2779 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2780 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2781 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2782 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
|
2783 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
|
2784 } |
20673
0ebd431a2256
patch 8.2.0890: no color in terminal window when 'termguicolor' is set
Bram Moolenaar <Bram@vim.org>
parents:
20619
diff
changeset
|
2785 at_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
|
2786 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
|
2787 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2788 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2789 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2790 #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
|
2791 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2792 * 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
|
2793 * 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
|
2794 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2795 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2796 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
|
2797 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2798 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
|
2799 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2800 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
|
2801 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
|
2802 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
|
2803 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
|
2804 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
|
2805 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2806 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2807 |
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 * 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
|
2810 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2811 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2812 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
|
2813 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2814 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2815 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
|
2816 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2817 #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
|
2818 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
|
2819 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2820 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
|
2821 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2822 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
|
2823 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
|
2824 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
|
2825 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2826 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
|
2827 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
|
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 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2831 * 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
|
2832 * (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
|
2833 * "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
|
2834 * 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
|
2835 * 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
|
2836 * result. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2837 * 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
|
2838 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2839 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2840 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
|
2841 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2842 attrentry_T *char_aep = NULL; |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2843 attrentry_T *prim_aep; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2844 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
|
2845 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2846 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
|
2847 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
|
2848 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
|
2849 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
|
2850 #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
|
2851 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
|
2852 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2853 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
|
2854 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
|
2855 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
|
2856 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
|
2857 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2858 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2859 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
|
2860 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
|
2861 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
|
2862 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
|
2863 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
|
2864 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
|
2865 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2866 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2867 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
|
2868 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
|
2869 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2870 { |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2871 prim_aep = syn_gui_attr2entry(prim_attr); |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2872 if (prim_aep != NULL) |
17389
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 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2875 prim_aep->ae_attr); |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2876 if (prim_aep->ae_u.gui.fg_color != INVALCOLOR) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2877 new_en.ae_u.gui.fg_color = prim_aep->ae_u.gui.fg_color; |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2878 if (prim_aep->ae_u.gui.bg_color != INVALCOLOR) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2879 new_en.ae_u.gui.bg_color = prim_aep->ae_u.gui.bg_color; |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2880 if (prim_aep->ae_u.gui.sp_color != INVALCOLOR) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2881 new_en.ae_u.gui.sp_color = prim_aep->ae_u.gui.sp_color; |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2882 if (prim_aep->ae_u.gui.font != NOFONT) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2883 new_en.ae_u.gui.font = prim_aep->ae_u.gui.font; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2884 # ifdef FEAT_XFONTSET |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2885 if (prim_aep->ae_u.gui.fontset != NOFONTSET) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2886 new_en.ae_u.gui.fontset = prim_aep->ae_u.gui.fontset; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2887 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2888 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2889 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2890 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
|
2891 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2892 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2893 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2894 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
|
2895 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2896 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
|
2897 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
|
2898 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
|
2899 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
|
2900 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2901 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2902 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
|
2903 #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
|
2904 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
|
2905 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
|
2906 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
|
2907 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2908 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
|
2909 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
|
2910 } |
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 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
|
2913 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
|
2914 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2915 { |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2916 prim_aep = syn_cterm_attr2entry(prim_attr); |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2917 if (prim_aep != NULL) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2918 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2919 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2920 prim_aep->ae_attr); |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2921 if (prim_aep->ae_u.cterm.fg_color > 0) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2922 new_en.ae_u.cterm.fg_color = prim_aep->ae_u.cterm.fg_color; |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2923 if (prim_aep->ae_u.cterm.bg_color > 0) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2924 new_en.ae_u.cterm.bg_color = prim_aep->ae_u.cterm.bg_color; |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2925 if (prim_aep->ae_u.cterm.ul_color > 0) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2926 new_en.ae_u.cterm.ul_color = prim_aep->ae_u.cterm.ul_color; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
2927 if (prim_aep->ae_u.cterm.font > 0) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
2928 new_en.ae_u.cterm.font = prim_aep->ae_u.cterm.font; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2929 #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
|
2930 // 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
|
2931 // Helps for SpellBad which uses undercurl in the GUI. |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2932 if (COLOR_INVALID(prim_aep->ae_u.cterm.fg_rgb) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2933 && COLOR_INVALID(prim_aep->ae_u.cterm.bg_rgb)) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2934 { |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2935 if (prim_aep->ae_u.cterm.fg_color > 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2936 new_en.ae_u.cterm.fg_rgb = CTERMCOLOR; |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2937 if (prim_aep->ae_u.cterm.bg_color > 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2938 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
|
2939 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2940 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2941 { |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2942 if (prim_aep->ae_u.cterm.fg_rgb != INVALCOLOR) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2943 new_en.ae_u.cterm.fg_rgb = prim_aep->ae_u.cterm.fg_rgb; |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2944 if (prim_aep->ae_u.cterm.bg_rgb != INVALCOLOR) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2945 new_en.ae_u.cterm.bg_rgb = prim_aep->ae_u.cterm.bg_rgb; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2946 } |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2947 if (prim_aep->ae_u.cterm.ul_rgb != INVALCOLOR) |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2948 new_en.ae_u.cterm.ul_rgb = prim_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
|
2949 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2950 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2951 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2952 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
|
2953 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2954 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2955 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
|
2956 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
|
2957 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
|
2958 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
|
2959 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2960 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
2961 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
|
2962 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
|
2963 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
|
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 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
|
2967 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
|
2968 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2969 { |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2970 prim_aep = syn_term_attr2entry(prim_attr); |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2971 if (prim_aep != NULL) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2972 { |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2973 new_en.ae_attr = ATTR_COMBINE(new_en.ae_attr, prim_aep->ae_attr); |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2974 if (prim_aep->ae_u.term.start != NULL) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2975 { |
29726
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2976 new_en.ae_u.term.start = prim_aep->ae_u.term.start; |
74b522939a3d
patch 9.0.0203: confusing variable name
Bram Moolenaar <Bram@vim.org>
parents:
29698
diff
changeset
|
2977 new_en.ae_u.term.stop = prim_aep->ae_u.term.stop; |
17389
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 } |
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 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
|
2982 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2983 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2984 #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
|
2985 attrentry_T * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2986 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
|
2987 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2988 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
|
2989 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
|
2990 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2991 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
|
2992 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2993 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2994 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2995 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2996 * 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
|
2997 * 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
|
2998 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
2999 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3000 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
|
3001 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3002 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
|
3003 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3004 #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
|
3005 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
|
3006 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
|
3007 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3008 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3009 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
|
3010 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
|
3011 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3012 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
|
3013 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3014 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
|
3015 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3016 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
|
3017 } |
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 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3020 attrentry_T * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3021 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
|
3022 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3023 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
|
3024 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
|
3025 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3026 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
|
3027 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3028 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3029 attrentry_T * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3030 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
|
3031 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3032 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
|
3033 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
|
3034 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3035 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
|
3036 } |
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 #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
|
3039 #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
|
3040 #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
|
3041 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3042 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3043 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
|
3044 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3045 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
|
3046 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
|
3047 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3048 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
|
3049 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3050 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
|
3051 return; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3052 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3053 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
|
3054 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
|
3055 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
|
3056 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
|
3057 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
|
3058 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
|
3059 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3060 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
|
3061 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
|
3062 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
|
3063 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
|
3064 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
|
3065 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
|
3066 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
|
3067 sgp->sg_cterm_ul, NULL, "ctermul"); |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3068 didh = highlight_list_arg(id, didh, LIST_INT, |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3069 sgp->sg_cterm_font, NULL, "ctermfont"); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3070 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3071 #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
|
3072 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
|
3073 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
|
3074 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
|
3075 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
|
3076 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
|
3077 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
|
3078 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
|
3079 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
|
3080 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3081 #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
|
3082 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
|
3083 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
|
3084 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3085 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3086 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
|
3087 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3088 (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
|
3089 didh = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3090 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
|
3091 msg_putchar(' '); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3092 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
|
3093 } |
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 (!didh) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3096 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
|
3097 #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
|
3098 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
|
3099 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
|
3100 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3101 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3102 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3103 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3104 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
|
3105 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3106 int didh, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3107 int type, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3108 int iarg, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3109 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
|
3110 char *name) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3111 { |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3112 char_u buf[MAX_ATTR_LEN]; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3113 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
|
3114 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3115 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3116 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
|
3117 return FALSE; |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3118 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3119 if (type == LIST_STRING ? (sarg == NULL) : (iarg == 0)) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3120 return didh; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3121 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3122 ts = buf; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3123 if (type == LIST_INT) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3124 sprintf((char *)buf, "%d", iarg - 1); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3125 else if (type == LIST_STRING) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3126 ts = sarg; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3127 else // type == LIST_ATTR |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3128 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3129 size_t buflen; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3130 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3131 buf[0] = NUL; |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3132 buflen = 0; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3133 for (i = 0; i < (int)ARRAY_LENGTH(highlight_index_tab); ++i) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3134 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3135 if (iarg & highlight_index_tab[i]->key) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3136 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3137 if (buflen > 0) |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3138 { |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3139 STRCPY(buf + buflen, (char_u *)","); |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3140 ++buflen; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3141 } |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3142 STRCPY(buf + buflen, (char_u *)highlight_index_tab[i]->value); |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3143 buflen += highlight_index_tab[i]->length; |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
3144 iarg &= ~highlight_index_tab[i]->key; // don't want "inverse"/"reverse" |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3145 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3146 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3147 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3148 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3149 (void)syn_list_header(didh, |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3150 (int)(vim_strsize(ts) + STRLEN(name) + 1), id); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3151 didh = TRUE; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3152 if (!got_int) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3153 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3154 if (*name != NUL) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3155 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3156 msg_puts_attr(name, HL_ATTR(HLF_D)); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3157 msg_puts_attr("=", HL_ATTR(HLF_D)); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3158 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3159 msg_outtrans(ts); |
17389
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 return didh; |
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 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3164 #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
|
3165 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3166 * 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
|
3167 * 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
|
3168 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3169 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3170 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
|
3171 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3172 int flag, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3173 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
|
3174 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3175 int attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3176 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3177 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
|
3178 return NULL; |
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(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
|
3181 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
|
3182 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
|
3183 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3184 #endif |
26009
990958e8c3a2
patch 8.2.3538: else-if indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents:
26005
diff
changeset
|
3185 { |
990958e8c3a2
patch 8.2.3538: else-if indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents:
26005
diff
changeset
|
3186 if (modec == 'c') |
990958e8c3a2
patch 8.2.3538: else-if indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents:
26005
diff
changeset
|
3187 attr = HL_TABLE()[id - 1].sg_cterm; |
990958e8c3a2
patch 8.2.3538: else-if indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents:
26005
diff
changeset
|
3188 else |
990958e8c3a2
patch 8.2.3538: else-if indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents:
26005
diff
changeset
|
3189 attr = HL_TABLE()[id - 1].sg_term; |
990958e8c3a2
patch 8.2.3538: else-if indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents:
26005
diff
changeset
|
3190 } |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3191 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3192 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
|
3193 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
|
3194 return NULL; |
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 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3197 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3198 #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
|
3199 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3200 * 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
|
3201 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3202 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3203 highlight_color( |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3204 int id, |
22446
0cdb03e73ce9
patch 8.2.1771: synIDattr() cannot get the value of ctermul
Bram Moolenaar <Bram@vim.org>
parents:
22312
diff
changeset
|
3205 char_u *what, // "font", "fg", "bg", "sp", "ul", "fg#", "bg#" or "sp#" |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3206 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
|
3207 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3208 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
|
3209 int n; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3210 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
|
3211 int sp = FALSE; |
22446
0cdb03e73ce9
patch 8.2.1771: synIDattr() cannot get the value of ctermul
Bram Moolenaar <Bram@vim.org>
parents:
22312
diff
changeset
|
3212 int ul = FALSE; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3213 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
|
3214 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3215 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
|
3216 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3217 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3218 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
|
3219 fg = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3220 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
|
3221 && 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
|
3222 font = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3223 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
|
3224 sp = TRUE; |
22446
0cdb03e73ce9
patch 8.2.1771: synIDattr() cannot get the value of ctermul
Bram Moolenaar <Bram@vim.org>
parents:
22312
diff
changeset
|
3225 else if (TOLOWER_ASC(what[0]) == 'u' && TOLOWER_ASC(what[1]) == 'l') |
0cdb03e73ce9
patch 8.2.1771: synIDattr() cannot get the value of ctermul
Bram Moolenaar <Bram@vim.org>
parents:
22312
diff
changeset
|
3226 ul = TRUE; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3227 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
|
3228 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3229 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
|
3230 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3231 # 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
|
3232 # 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
|
3233 // 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
|
3234 if (font) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3235 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
|
3236 # endif |
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 // 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
|
3239 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
|
3240 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3241 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
|
3242 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
|
3243 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
|
3244 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3245 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3246 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
|
3247 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
|
3248 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
|
3249 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3250 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
|
3251 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
|
3252 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3253 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
|
3254 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
|
3255 (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
|
3256 (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
|
3257 (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
|
3258 return buf; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3259 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3260 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3261 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3262 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
|
3263 if (sp) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3264 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
|
3265 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
|
3266 } |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3267 if (sp) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3268 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3269 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
|
3270 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3271 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3272 n = HL_TABLE()[id - 1].sg_cterm_fg - 1; |
22446
0cdb03e73ce9
patch 8.2.1771: synIDattr() cannot get the value of ctermul
Bram Moolenaar <Bram@vim.org>
parents:
22312
diff
changeset
|
3273 else if (ul) |
0cdb03e73ce9
patch 8.2.1771: synIDattr() cannot get the value of ctermul
Bram Moolenaar <Bram@vim.org>
parents:
22312
diff
changeset
|
3274 n = HL_TABLE()[id - 1].sg_cterm_ul - 1; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3275 else if (font) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3276 n = HL_TABLE()[id - 1].sg_cterm_font - 1; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3277 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3278 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
|
3279 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
|
3280 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3281 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
|
3282 return name; |
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 // 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
|
3285 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3286 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3287 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3288 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3289 #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
|
3290 && (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
|
3291 && 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
|
3292 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3293 * 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
|
3294 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3295 long_u |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3296 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
|
3297 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3298 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
|
3299 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3300 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
|
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 <= 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
|
3303 return 0L; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3304 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3305 if (fg) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3306 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
|
3307 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3308 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
|
3309 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3310 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
|
3311 return 0L; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3312 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3313 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
|
3314 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3315 #endif |
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 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3318 * 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
|
3319 * 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
|
3320 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3321 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3322 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
|
3323 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
|
3324 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
|
3325 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
|
3326 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3327 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
|
3328 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
|
3329 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
|
3330 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3331 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
|
3332 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3333 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
|
3334 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
|
3335 return TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3336 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
|
3337 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
|
3338 endcol = 15; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3339 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3340 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
|
3341 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3342 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
|
3343 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
|
3344 return TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3345 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3346 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3347 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3348 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
|
3349 newline = FALSE; |
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 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3352 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
|
3353 endcol = msg_col + 1; |
35764
3ead9668d632
patch 9.1.0608: Coverity warns about a few potential issues
Christian Brabandt <cb@256bit.org>
parents:
35375
diff
changeset
|
3354 if (Columns <= (long)endcol) // avoid hang for tiny window |
3ead9668d632
patch 9.1.0608: Coverity warns about a few potential issues
Christian Brabandt <cb@256bit.org>
parents:
35375
diff
changeset
|
3355 endcol = (int)(Columns - 1); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3356 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3357 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
|
3358 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3359 // 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
|
3360 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
|
3361 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3362 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
|
3363 msg_putchar(' '); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3364 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
|
3365 msg_putchar(' '); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3366 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3367 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3368 return newline; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3369 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3370 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3371 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3372 * 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
|
3373 * 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
|
3374 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3375 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3376 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
|
3377 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
|
3378 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3379 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
|
3380 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
|
3381 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3382 // 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
|
3383 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
|
3384 return; |
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 #ifdef FEAT_GUI |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3387 // For the GUI mode: If there are other than "normal" highlighting |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3388 // attributes, need to allocate an attr number. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3389 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
|
3390 && 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
|
3391 && 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
|
3392 && 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
|
3393 # 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
|
3394 && 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
|
3395 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3396 ) |
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 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
|
3399 } |
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 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3402 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
|
3403 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
|
3404 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
|
3405 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
|
3406 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
|
3407 # 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
|
3408 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
|
3409 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3410 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
|
3411 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3412 #endif |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3413 // For the term mode: If there are other than "normal" highlighting |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3414 // attributes, need to allocate an attr number. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3415 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
|
3416 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
|
3417 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3418 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3419 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
|
3420 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
|
3421 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
|
3422 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
|
3423 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3424 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3425 // For the color term mode: If there are other than "normal" |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3426 // highlighting attributes, need to allocate an attr number. |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3427 if (sgp->sg_cterm_fg == 0 && sgp->sg_cterm_bg == 0 && |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3428 sgp->sg_cterm_ul == 0 && sgp->sg_cterm_font == 0 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3429 # 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
|
3430 && 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
|
3431 && 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
|
3432 && 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
|
3433 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3434 ) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3435 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
|
3436 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3437 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3438 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
|
3439 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
|
3440 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
|
3441 at_en.ae_u.cterm.ul_color = sgp->sg_cterm_ul; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3442 at_en.ae_u.cterm.font = sgp->sg_cterm_font; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3443 # 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
|
3444 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
|
3445 at_en.ae_u.cterm.bg_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_bg); |
20705
5481c982a279
patch 8.2.0906: when setting 'termguicolors' SpellBad is no longer red
Bram Moolenaar <Bram@vim.org>
parents:
20675
diff
changeset
|
3446 // Only use the underline/undercurl color when used, it may clear the |
5481c982a279
patch 8.2.0906: when setting 'termguicolors' SpellBad is no longer red
Bram Moolenaar <Bram@vim.org>
parents:
20675
diff
changeset
|
3447 // background color if not supported. |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3448 if (sgp->sg_cterm & (HL_UNDERLINE | HL_UNDERCURL |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3449 | HL_UNDERDOUBLE | HL_UNDERDOTTED | HL_UNDERDASHED)) |
20705
5481c982a279
patch 8.2.0906: when setting 'termguicolors' SpellBad is no longer red
Bram Moolenaar <Bram@vim.org>
parents:
20675
diff
changeset
|
3450 at_en.ae_u.cterm.ul_rgb = GUI_MCH_GET_RGB2(sgp->sg_gui_sp); |
5481c982a279
patch 8.2.0906: when setting 'termguicolors' SpellBad is no longer red
Bram Moolenaar <Bram@vim.org>
parents:
20675
diff
changeset
|
3451 else |
5481c982a279
patch 8.2.0906: when setting 'termguicolors' SpellBad is no longer red
Bram Moolenaar <Bram@vim.org>
parents:
20675
diff
changeset
|
3452 at_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
|
3453 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
|
3454 && 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
|
3455 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3456 // 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
|
3457 // 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
|
3458 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
|
3459 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
|
3460 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3461 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3462 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
|
3463 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3464 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3465 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3466 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3467 * 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
|
3468 * 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
|
3469 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3470 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3471 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
|
3472 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3473 int i; |
26454
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
3474 char_u name_u[MAX_SYN_NAME + 1]; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3475 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3476 // 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
|
3477 // 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
|
3478 // don't deserve to be found! |
26454
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
3479 vim_strncpy(name_u, name, MAX_SYN_NAME); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3480 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
|
3481 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
|
3482 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
|
3483 && 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
|
3484 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3485 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
|
3486 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3487 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3488 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3489 * 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
|
3490 * 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
|
3491 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3492 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3493 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
|
3494 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3495 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
|
3496 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3497 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
|
3498 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
|
3499 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3500 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3501 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3502 #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
|
3503 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3504 * 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
|
3505 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3506 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3507 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
|
3508 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3509 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
|
3510 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3511 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3512 # 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
|
3513 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3514 * 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
|
3515 * 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
|
3516 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3517 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3518 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
|
3519 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3520 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
|
3521 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
|
3522 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
|
3523 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3524 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3525 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3526 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3527 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3528 * 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
|
3529 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3530 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3531 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
|
3532 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3533 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
|
3534 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
|
3535 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3536 name = vim_strnsave(linep, len); |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3537 if (name == NULL) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3538 return 0; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3539 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3540 id = syn_name2id(name); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
3541 vim_free(name); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3542 return id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3543 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3544 |
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 * 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
|
3547 * 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
|
3548 * 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
|
3549 * 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
|
3550 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3551 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3552 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
|
3553 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3554 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3555 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
|
3556 |
26454
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
3557 if (len > MAX_SYN_NAME) |
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
3558 { |
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
3559 emsg(_(e_highlight_group_name_too_long)); |
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
3560 return 0; |
9998318235cd
patch 8.2.3757: an overlong highlight group name is silently truncated
Bram Moolenaar <Bram@vim.org>
parents:
26274
diff
changeset
|
3561 } |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3562 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
|
3563 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
|
3564 return 0; |
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 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
|
3567 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
|
3568 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
|
3569 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3570 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
|
3571 return id; |
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 |
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 * 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
|
3576 * "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
|
3577 * 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
|
3578 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3579 static int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3580 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
|
3581 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3582 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
|
3583 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
|
3584 |
32916
dcab5385dd02
patch 9.0.1767: '.-' no allowed in highlight group names
Christian Brabandt <cb@256bit.org>
parents:
32132
diff
changeset
|
3585 // Check that the name is valid (ASCII letters, digits, underscores, dots, or hyphens). |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3586 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
|
3587 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3588 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
|
3589 { |
26952
b34ddbca305c
patch 8.2.4005: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26915
diff
changeset
|
3590 emsg(_(e_unprintable_character_in_group_name)); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3591 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
|
3592 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3593 } |
32916
dcab5385dd02
patch 9.0.1767: '.-' no allowed in highlight group names
Christian Brabandt <cb@256bit.org>
parents:
32132
diff
changeset
|
3594 else if (!ASCII_ISALNUM(*p) && *p != '_' && *p != '.' && *p != '-') |
17389
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 // 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
|
3597 // 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
|
3598 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
|
3599 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
|
3600 break; |
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 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3603 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3604 // First call for this growarray: init growing array. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3605 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
|
3606 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3607 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
|
3608 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
|
3609 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3610 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3611 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
|
3612 { |
26962
85866e069c24
patch 8.2.4010: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26952
diff
changeset
|
3613 emsg(_(e_too_many_highlight_and_syntax_groups)); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3614 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
|
3615 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3616 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3617 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3618 // Make room for at least one other syntax_highlight entry. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3619 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
|
3620 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3621 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
|
3622 return 0; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3623 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3624 |
17797
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3625 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
|
3626 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
|
3627 { |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3628 vim_free(name); |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3629 return 0; |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3630 } |
ec1717981acf
patch 8.1.1895: using NULL pointer when out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17781
diff
changeset
|
3631 |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
3632 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
|
3633 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
|
3634 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
|
3635 #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
|
3636 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
|
3637 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
|
3638 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
|
3639 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3640 ++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
|
3641 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3642 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
|
3643 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3644 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3645 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3646 * 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
|
3647 * 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
|
3648 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3649 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3650 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
|
3651 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3652 --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
|
3653 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
|
3654 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
|
3655 } |
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 * Translate a group ID to highlight attributes. |
29698
b944b7fb563b
patch 9.0.0189: invalid memory access for text prop without highlight
Bram Moolenaar <Bram@vim.org>
parents:
29442
diff
changeset
|
3659 * "hl_id" must be valid: > 0, caller must check. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3660 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3661 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3662 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
|
3663 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3664 int attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3665 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
|
3666 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3667 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
|
3668 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
|
3669 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3670 #ifdef FEAT_GUI |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3671 // Only use GUI attr when the GUI is being used. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3672 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
|
3673 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
|
3674 else |
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 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
|
3677 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
|
3678 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3679 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
|
3680 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3681 return attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3682 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3683 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3684 #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
|
3685 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3686 * 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
|
3687 * 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
|
3688 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3689 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3690 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
|
3691 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3692 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
|
3693 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3694 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
|
3695 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
|
3696 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3697 *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
|
3698 *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
|
3699 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
|
3700 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3701 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3702 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3703 #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
|
3704 && (!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
|
3705 && 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
|
3706 || 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
|
3707 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3708 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
|
3709 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3710 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
|
3711 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3712 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
|
3713 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
|
3714 *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
|
3715 *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
|
3716 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3717 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3718 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3719 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3720 * 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
|
3721 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3722 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3723 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
|
3724 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3725 int count; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3726 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
|
3727 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3728 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
|
3729 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
|
3730 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3731 // Follow links until there is no more. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3732 // Look out for loops! Break after 100 links. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3733 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
|
3734 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3735 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
|
3736 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
|
3737 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3738 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
|
3739 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3740 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3741 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
|
3742 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3743 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3744 #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
|
3745 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3746 * 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
|
3747 * 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
|
3748 * 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
|
3749 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3750 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3751 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
|
3752 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3753 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3754 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3755 // 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
|
3756 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
|
3757 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
|
3758 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3759 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
|
3760 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
|
3761 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3762 highlight_changed(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3763 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3764 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3765 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3766 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
|
3767 int idx, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3768 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
|
3769 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
|
3770 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3771 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
|
3772 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3773 # 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
|
3774 # 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
|
3775 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
|
3776 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3777 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
|
3778 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3779 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
|
3780 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
|
3781 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3782 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3783 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3784 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
|
3785 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3786 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
|
3787 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
|
3788 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3789 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3790 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
|
3791 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3792 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
|
3793 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
|
3794 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3795 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3796 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
|
3797 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3798 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
|
3799 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
|
3800 didit = TRUE; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3801 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3802 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
|
3803 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
|
3804 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3805 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3806 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3807 #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
|
3808 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3809 * 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
|
3810 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3811 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3812 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
|
3813 int id, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3814 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
|
3815 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
|
3816 int hlcnt, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3817 int i, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3818 int hlf, |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3819 int *table) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3820 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3821 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
|
3822 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3823 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
|
3824 { |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
3825 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
|
3826 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
|
3827 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
|
3828 # 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
|
3829 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
|
3830 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3831 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3832 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3833 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
|
3834 &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
|
3835 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
|
3836 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
|
3837 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3838 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
|
3839 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
|
3840 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
|
3841 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
|
3842 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
|
3843 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
|
3844 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
|
3845 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
|
3846 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
|
3847 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
|
3848 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
|
3849 hlt[hlcnt + i].sg_cterm_bg = hlt[id - 1].sg_cterm_bg; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3850 if (hlt[id - 1].sg_cterm_font != hlt[id_S - 1].sg_cterm_font) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
3851 hlt[hlcnt + i].sg_cterm_font = hlt[id - 1].sg_cterm_font; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3852 # 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
|
3853 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
|
3854 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
|
3855 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3856 # 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
|
3857 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
|
3858 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
|
3859 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
|
3860 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
|
3861 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
|
3862 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
|
3863 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
|
3864 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
|
3865 # 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
|
3866 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
|
3867 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
|
3868 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3869 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3870 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
|
3871 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
|
3872 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
|
3873 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3874 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3875 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3876 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3877 * 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
|
3878 * 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
|
3879 * 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
|
3880 * 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
|
3881 * 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
|
3882 * 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
|
3883 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3884 int |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3885 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
|
3886 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3887 int hlf; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3888 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3889 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
|
3890 int attr; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3891 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
|
3892 int id; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3893 #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
|
3894 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
|
3895 # 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
|
3896 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
|
3897 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
|
3898 # 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
|
3899 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
|
3900 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
|
3901 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3902 int hlcnt; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3903 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3904 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3905 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
|
3906 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3907 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
|
3908 |
26193
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
3909 #ifdef FEAT_TERMINAL |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
3910 term_update_colors_all(); |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
3911 term_update_wincolor_all(); |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
3912 #endif |
c83460a14407
patch 8.2.3628: looking terminal colors is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
26145
diff
changeset
|
3913 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3914 // Clear all attributes. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3915 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
|
3916 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
|
3917 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3918 // First set all attributes to their default value. |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3919 // Then use the attributes from the 'highlight' option. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3920 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
|
3921 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3922 if (i) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3923 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
|
3924 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3925 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
|
3926 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
|
3927 continue; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3928 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3929 while (*p) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3930 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3931 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
|
3932 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
|
3933 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3934 ++p; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3935 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
|
3936 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3937 |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3938 // Allow several hl_flags to be combined, like "bu" for |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
3939 // bold-underlined. |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3940 attr = 0; |
18806
e966de1d0376
patch 8.1.2391: cannot build when __QNXNTO__ is defined
Bram Moolenaar <Bram@vim.org>
parents:
18498
diff
changeset
|
3941 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
|
3942 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3943 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
|
3944 continue; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3945 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3946 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
|
3947 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3948 |
33399
95db67c7b754
patch 9.0.1958: cannot complete option values
Christian Brabandt <cb@256bit.org>
parents:
32916
diff
changeset
|
3949 // Note: Keep this in sync with expand_set_highlight(). |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3950 switch (*p) |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3951 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3952 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
|
3953 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3954 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
|
3955 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3956 case '-': |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3957 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
|
3958 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3959 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
|
3960 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3961 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
|
3962 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3963 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
|
3964 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3965 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
|
3966 break; |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3967 case '2': attr |= HL_UNDERDOUBLE; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3968 break; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3969 case 'd': attr |= HL_UNDERDOTTED; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3970 break; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3971 case '=': attr |= HL_UNDERDASHED; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
3972 break; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3973 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
|
3974 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3975 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
|
3976 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
|
3977 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3978 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
|
3979 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
|
3980 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
|
3981 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
|
3982 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
|
3983 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3984 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
|
3985 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
|
3986 #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
|
3987 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
|
3988 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
|
3989 # 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
|
3990 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
|
3991 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
|
3992 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
|
3993 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
|
3994 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3995 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
|
3996 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
|
3997 #endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3998 break; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
3999 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
|
4000 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4001 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4002 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
|
4003 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4004 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
|
4005 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4006 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4007 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4008 #ifdef USER_HIGHLIGHT |
26005
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4009 // Setup the user highlights |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4010 // |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4011 // Temporarily utilize 28 more hl entries: |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4012 // 9 for User1-User9 combined with StatusLineNC |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4013 // 9 for User1-User9 combined with StatusLineTerm |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4014 // 9 for User1-User9 combined with StatusLineTermNC |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4015 // 1 for StatusLine default |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4016 // Have to be in there simultaneously in case of table overflows in |
8fceae196d4f
patch 8.2.3536: the do_highlight() function is way too long
Bram Moolenaar <Bram@vim.org>
parents:
25965
diff
changeset
|
4017 // get_attr_entry() |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4018 # 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
|
4019 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
|
4020 return FAIL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4021 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
|
4022 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
|
4023 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4024 // 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
|
4025 // entry. |
20007
aadd1cae2ff5
patch 8.2.0559: clearing a struct is verbose
Bram Moolenaar <Bram@vim.org>
parents:
19892
diff
changeset
|
4026 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
|
4027 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
|
4028 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
|
4029 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4030 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4031 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
|
4032 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4033 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
|
4034 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
|
4035 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
|
4036 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4037 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
|
4038 # 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
|
4039 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
|
4040 # 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
|
4041 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
|
4042 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
|
4043 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4044 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4045 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4046 else |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4047 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4048 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
|
4049 # 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
|
4050 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
|
4051 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
|
4052 # 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
|
4053 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
|
4054 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
|
4055 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
|
4056 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
|
4057 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4058 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4059 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4060 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4061 # 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
|
4062 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
|
4063 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4064 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4065 #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
|
4066 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4067 return OK; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4068 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4069 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4070 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
|
4071 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
|
4072 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4073 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4074 * 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
|
4075 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4076 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4077 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
|
4078 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4079 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
|
4080 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4081 // 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
|
4082 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
|
4083 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
|
4084 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
|
4085 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
|
4086 |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4087 if (*arg == NUL) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4088 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4089 |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4090 // (part of) subcommand already typed |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4091 p = skiptowhite(arg); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4092 if (*p == NUL) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4093 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4094 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4095 // past "default" or group name |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4096 include_default = 0; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4097 if (STRNCMP("default", arg, p - arg) == 0) |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4098 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4099 arg = skipwhite(p); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4100 xp->xp_pattern = arg; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4101 p = skiptowhite(arg); |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4102 } |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4103 if (*p == NUL) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4104 return; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4105 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4106 // past group name |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4107 include_link = 0; |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4108 if (arg[1] == 'i' && arg[0] == 'N') |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4109 highlight_list(); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4110 if (STRNCMP("link", arg, p - arg) == 0 |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4111 || STRNCMP("clear", arg, p - arg) == 0) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4112 { |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4113 xp->xp_pattern = skipwhite(p); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4114 p = skiptowhite(xp->xp_pattern); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4115 if (*p != NUL) // past first group name |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4116 { |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4117 xp->xp_pattern = skipwhite(p); |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4118 p = skiptowhite(xp->xp_pattern); |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4119 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4120 } |
31667
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4121 if (*p != NUL) // past group name(s) |
b89cfd86e18e
patch 9.0.1166: code is indented more than necessary
Bram Moolenaar <Bram@vim.org>
parents:
31602
diff
changeset
|
4122 xp->xp_context = EXPAND_NOTHING; |
17389
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4123 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4124 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4125 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4126 * 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
|
4127 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4128 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4129 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
|
4130 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4131 int i; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4132 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4133 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
|
4134 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
|
4135 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
|
4136 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
|
4137 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4138 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4139 static void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4140 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
|
4141 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4142 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
|
4143 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
|
4144 out_flush(); |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4145 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
|
4146 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4147 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4148 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4149 * 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
|
4150 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4151 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4152 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
|
4153 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4154 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
|
4155 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4156 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4157 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4158 * 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
|
4159 * 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
|
4160 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4161 char_u * |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4162 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
|
4163 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4164 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
|
4165 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4166 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4167 // 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
|
4168 // cleared. |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4169 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
|
4170 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
|
4171 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4172 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
|
4173 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
|
4174 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
|
4175 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
|
4176 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
|
4177 && 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
|
4178 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
|
4179 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
|
4180 && 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
|
4181 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
|
4182 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
|
4183 return NULL; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4184 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
|
4185 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4186 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4187 #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
|
4188 /* |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4189 * 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
|
4190 * 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
|
4191 */ |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4192 void |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4193 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
|
4194 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4195 int idx; |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4196 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4197 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
|
4198 { |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4199 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
|
4200 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
|
4201 # 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
|
4202 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
|
4203 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
|
4204 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4205 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4206 |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4207 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
|
4208 # 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
|
4209 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
|
4210 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4211 # 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
|
4212 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
|
4213 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
|
4214 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
|
4215 # endif |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4216 } |
635d7f5010b8
patch 8.1.1693: syntax coloring and highlighting is in one big file
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
4217 #endif |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4218 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4219 #if defined(FEAT_EVAL) || defined(PROTO) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4220 /* |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4221 * Convert each of the highlight attribute bits (bold, standout, underline, |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4222 * etc.) set in 'hlattr' into a separate boolean item in a Dictionary with |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4223 * the attribute name as the key. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4224 */ |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4225 static dict_T * |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4226 highlight_get_attr_dict(int hlattr) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4227 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4228 dict_T *dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4229 int i; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4230 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4231 dict = dict_alloc(); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4232 if (dict == NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4233 return NULL; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4234 |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4235 for (i = 0; i < (int)ARRAY_LENGTH(highlight_index_tab); ++i) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4236 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4237 if (hlattr & highlight_index_tab[i]->key) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4238 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4239 dict_add_bool(dict, highlight_index_tab[i]->value, VVAL_TRUE); |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4240 hlattr &= ~highlight_index_tab[i]->key; // don't want "inverse"/"reverse" |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4241 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4242 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4243 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4244 return dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4245 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4246 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4247 /* |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4248 * Return the attributes of the highlight group at index 'hl_idx' as a |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4249 * Dictionary. If 'resolve_link' is TRUE, then resolves the highlight group |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4250 * links recursively. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4251 */ |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4252 static dict_T * |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4253 highlight_get_info(int hl_idx, int resolve_link) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4254 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4255 dict_T *dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4256 hl_group_T *sgp; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4257 dict_T *attr_dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4258 int hlgid; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4259 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4260 dict = dict_alloc(); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4261 if (dict == NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4262 return dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4263 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4264 sgp = &HL_TABLE()[hl_idx]; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4265 // highlight group id is 1-based |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4266 hlgid = hl_idx + 1; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4267 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4268 if (dict_add_string(dict, "name", sgp->sg_name) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4269 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4270 if (dict_add_number(dict, "id", hlgid) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4271 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4272 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4273 if (sgp->sg_link && resolve_link) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4274 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4275 // resolve the highlight group link recursively |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4276 while (sgp->sg_link) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4277 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4278 hlgid = sgp->sg_link; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4279 sgp = &HL_TABLE()[sgp->sg_link - 1]; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4280 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4281 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4282 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4283 if (sgp->sg_term != 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4284 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4285 attr_dict = highlight_get_attr_dict(sgp->sg_term); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4286 if (attr_dict != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4287 if (dict_add_dict(dict, "term", attr_dict) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4288 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4289 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4290 if (sgp->sg_start != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4291 if (dict_add_string(dict, "start", sgp->sg_start) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4292 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4293 if (sgp->sg_stop != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4294 if (dict_add_string(dict, "stop", sgp->sg_stop) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4295 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4296 if (sgp->sg_cterm != 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4297 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4298 attr_dict = highlight_get_attr_dict(sgp->sg_cterm); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4299 if (attr_dict != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4300 if (dict_add_dict(dict, "cterm", attr_dict) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4301 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4302 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4303 if (sgp->sg_cterm_fg != 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4304 if (dict_add_string(dict, "ctermfg", |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4305 highlight_color(hlgid, (char_u *)"fg", 'c')) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4306 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4307 if (sgp->sg_cterm_bg != 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4308 if (dict_add_string(dict, "ctermbg", |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4309 highlight_color(hlgid, (char_u *)"bg", 'c')) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4310 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4311 if (sgp->sg_cterm_ul != 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4312 if (dict_add_string(dict, "ctermul", |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4313 highlight_color(hlgid, (char_u *)"ul", 'c')) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4314 goto error; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4315 if (sgp->sg_cterm_font != 0) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4316 if (dict_add_string(dict, "ctermfont", |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4317 highlight_color(hlgid, (char_u *)"font", 'c')) == FAIL) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4318 goto error; |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4319 if (sgp->sg_gui != 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4320 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4321 attr_dict = highlight_get_attr_dict(sgp->sg_gui); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4322 if (attr_dict != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4323 if (dict_add_dict(dict, "gui", attr_dict) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4324 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4325 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4326 if (sgp->sg_gui_fg_name != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4327 if (dict_add_string(dict, "guifg", |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4328 highlight_color(hlgid, (char_u *)"fg", 'g')) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4329 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4330 if (sgp->sg_gui_bg_name != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4331 if (dict_add_string(dict, "guibg", |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4332 highlight_color(hlgid, (char_u *)"bg", 'g')) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4333 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4334 if (sgp->sg_gui_sp_name != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4335 if (dict_add_string(dict, "guisp", |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4336 highlight_color(hlgid, (char_u *)"sp", 'g')) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4337 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4338 # ifdef FEAT_GUI |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4339 if (sgp->sg_font_name != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4340 if (dict_add_string(dict, "font", sgp->sg_font_name) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4341 goto error; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4342 # endif |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4343 if (sgp->sg_link) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4344 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4345 char_u *link; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4346 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4347 link = HL_TABLE()[sgp->sg_link - 1].sg_name; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4348 if (link != NULL && dict_add_string(dict, "linksto", link) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4349 goto error; |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4350 |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4351 if (sgp->sg_deflink) |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4352 dict_add_bool(dict, "default", VVAL_TRUE); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4353 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4354 if (dict_len(dict) == 2) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4355 // If only 'name' is present, then the highlight group is cleared. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4356 dict_add_bool(dict, "cleared", VVAL_TRUE); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4357 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4358 return dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4359 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4360 error: |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4361 vim_free(dict); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4362 return NULL; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4363 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4364 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4365 /* |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4366 * "hlget([name])" function |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4367 * Return the attributes of a specific highlight group (if specified) or all |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4368 * the highlight groups. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4369 */ |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4370 void |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4371 f_hlget(typval_T *argvars, typval_T *rettv) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4372 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4373 list_T *list; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4374 dict_T *dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4375 int i; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4376 char_u *hlarg = NULL; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4377 int resolve_link = FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4378 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4379 if (rettv_list_alloc(rettv) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4380 return; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4381 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4382 if (check_for_opt_string_arg(argvars, 0) == FAIL |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4383 || (argvars[0].v_type != VAR_UNKNOWN |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4384 && check_for_opt_bool_arg(argvars, 1) == FAIL)) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4385 return; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4386 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4387 if (argvars[0].v_type != VAR_UNKNOWN) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4388 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4389 // highlight group name supplied |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4390 hlarg = tv_get_string_chk(&argvars[0]); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4391 if (hlarg == NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4392 return; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4393 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4394 if (argvars[1].v_type != VAR_UNKNOWN) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4395 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4396 int error = FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4397 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4398 resolve_link = tv_get_bool_chk(&argvars[1], &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4399 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4400 return; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4401 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4402 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4403 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4404 list = rettv->vval.v_list; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4405 for (i = 0; i < highlight_ga.ga_len && !got_int; ++i) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4406 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4407 if (hlarg == NULL || STRICMP(hlarg, HL_TABLE()[i].sg_name) == 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4408 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4409 dict = highlight_get_info(i, resolve_link); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4410 if (dict != NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4411 list_append_dict(list, dict); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4412 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4413 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4414 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4415 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4416 /* |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4417 * Returns the string value at 'dict[key]'. Returns NULL, if 'key' is not in |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4418 * 'dict' or the value is not a string type. If the value is not a string type |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4419 * or is NULL, then 'error' is set to TRUE. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4420 */ |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4421 static char_u * |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4422 hldict_get_string(dict_T *dict, char_u *key, int *error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4423 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4424 dictitem_T *di; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4425 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4426 *error = FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4427 di = dict_find(dict, key, -1); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4428 if (di == NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4429 return NULL; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4430 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4431 if (di->di_tv.v_type != VAR_STRING || di->di_tv.vval.v_string == NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4432 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
4433 emsg(_(e_string_required)); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4434 *error = TRUE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4435 return NULL; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4436 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4437 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4438 return di->di_tv.vval.v_string; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4439 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4440 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4441 /* |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4442 * Convert the highlight attribute Dictionary at 'dict[key]' into a string |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4443 * value in 'attr_str' of length 'len'. Returns FALSE if 'dict[key]' is not a |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4444 * Dictionary or is NULL. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4445 */ |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4446 static int |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4447 hldict_attr_to_str( |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4448 dict_T *dict, |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4449 char_u *key, |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4450 char_u *attr_str, |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4451 size_t len) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4452 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4453 dictitem_T *di; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4454 dict_T *attrdict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4455 int i; |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4456 char_u *p; |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4457 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4458 attr_str[0] = NUL; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4459 di = dict_find(dict, key, -1); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4460 if (di == NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4461 return TRUE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4462 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4463 if (di->di_tv.v_type != VAR_DICT || di->di_tv.vval.v_dict == NULL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4464 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
4465 emsg(_(e_dictionary_required)); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4466 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4467 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4468 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4469 attrdict = di->di_tv.vval.v_dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4470 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4471 // If the attribute dict is empty, then return NONE to clear the attributes |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4472 if (dict_len(attrdict) == 0) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4473 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4474 vim_strcat(attr_str, (char_u *)"NONE", len); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4475 return TRUE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4476 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4477 |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4478 p = attr_str; |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4479 for (i = 0; i < (int)ARRAY_LENGTH(highlight_tab); ++i) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4480 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4481 if (dict_get_bool(attrdict, highlight_tab[i].value, VVAL_FALSE) == VVAL_TRUE) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4482 { |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4483 if (p != attr_str && (size_t)(p - attr_str + 2) < len) |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4484 STRCPY(p, (char_u *)","); |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4485 if (p - attr_str + highlight_tab[i].length + 1 < len) |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4486 { |
34820
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4487 STRCPY(p, highlight_tab[i].value); |
3d1e6800e2a8
patch 9.1.0282: Finding highlighting attributes is inefficient
Christian Brabandt <cb@256bit.org>
parents:
34347
diff
changeset
|
4488 p += highlight_tab[i].length; |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4489 } |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4490 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4491 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4492 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4493 return TRUE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4494 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4495 |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4496 // Temporary buffer used to store the command string produced by hlset(). |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4497 // IObuff cannot be used for this as the error messages produced by hlset() |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4498 // internally use IObuff. |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4499 #define HLSETBUFSZ 512 |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4500 static char_u hlsetBuf[HLSETBUFSZ + 1]; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4501 |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4502 /* |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4503 * Add the highlight attribute "attr" of length "attrlen" and "value" at |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4504 * "dptr", which points into "hlsetBuf". |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4505 * Returns the updated pointer. |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4506 */ |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4507 static char_u * |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4508 add_attr_and_value(char_u *dptr, char_u *attr, int attrlen, char_u *value) |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4509 { |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4510 size_t vallen; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4511 |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4512 // Do nothing if the value is not specified or is empty |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4513 if (value == NULL || *value == NUL) |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4514 return dptr; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4515 |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4516 vallen = STRLEN(value); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4517 if (dptr + attrlen + vallen + 1 < hlsetBuf + HLSETBUFSZ) |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4518 { |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4519 STRCPY(dptr, attr); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4520 dptr += attrlen; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4521 STRCPY(dptr, value); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4522 dptr += vallen; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4523 } |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4524 |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4525 return dptr; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4526 } |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4527 |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4528 /* |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4529 * Add or update a highlight group using 'dict' items. Returns TRUE if |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4530 * successfully updated the highlight group. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4531 */ |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4532 static int |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4533 hlg_add_or_update(dict_T *dict) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4534 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4535 char_u *name; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4536 int error; |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
4537 char_u term_attr[MAX_ATTR_LEN]; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
4538 char_u cterm_attr[MAX_ATTR_LEN]; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29320
diff
changeset
|
4539 char_u gui_attr[MAX_ATTR_LEN]; |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4540 char_u *start; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4541 char_u *stop; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4542 char_u *ctermfg; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4543 char_u *ctermbg; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4544 char_u *ctermul; |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4545 char_u *ctermfont; |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4546 char_u *guifg; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4547 char_u *guibg; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4548 char_u *guisp; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4549 # ifdef FEAT_GUI |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4550 char_u *font; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4551 # endif |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4552 int forceit = FALSE; |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4553 int dodefault = FALSE; |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4554 int done = FALSE; |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4555 char_u *p; |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4556 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4557 name = hldict_get_string(dict, (char_u *)"name", &error); |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4558 if (name == NULL || *name == NUL || error) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4559 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4560 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4561 if (dict_get_bool(dict, "force", VVAL_FALSE) == VVAL_TRUE) |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4562 forceit = TRUE; |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4563 |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4564 if (dict_get_bool(dict, "default", VVAL_FALSE) == VVAL_TRUE) |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4565 dodefault = TRUE; |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4566 |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
27752
diff
changeset
|
4567 if (dict_has_key(dict, "cleared")) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4568 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4569 varnumber_T cleared; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4570 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4571 // clear a highlight group |
29442
827d9f2b7a71
patch 9.0.0063: too many type casts for dict_get functions
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4572 cleared = dict_get_bool(dict, "cleared", FALSE); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4573 if (cleared == TRUE) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4574 { |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4575 vim_snprintf((char *)hlsetBuf, HLSETBUFSZ, "clear %s", name); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4576 do_highlight(hlsetBuf, forceit, FALSE); |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4577 done = TRUE; |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4578 } |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4579 } |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4580 |
28315
62cc3b60493b
patch 8.2.4683: verbose check with dict_find() to see if a key is present
Bram Moolenaar <Bram@vim.org>
parents:
27752
diff
changeset
|
4581 if (dict_has_key(dict, "linksto")) |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4582 { |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4583 char_u *linksto; |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4584 |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4585 // link highlight groups |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4586 linksto = hldict_get_string(dict, (char_u *)"linksto", &error); |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4587 if (linksto == NULL || *linksto == NUL || error) |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4588 return FALSE; |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4589 |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4590 vim_snprintf((char *)hlsetBuf, HLSETBUFSZ, "%slink %s %s", |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4591 dodefault ? "default " : "", name, linksto); |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4592 do_highlight(hlsetBuf, forceit, FALSE); |
26145
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4593 |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4594 done = TRUE; |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4595 } |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4596 |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4597 // If 'cleared' or 'linksto' are specified, then don't process the other |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4598 // attributes. |
3da380450cce
patch 8.2.3605: cannot clear and unlinke a highlight group with hlset()
Bram Moolenaar <Bram@vim.org>
parents:
26115
diff
changeset
|
4599 if (done) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4600 return TRUE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4601 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4602 start = hldict_get_string(dict, (char_u *)"start", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4603 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4604 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4605 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4606 stop = hldict_get_string(dict, (char_u *)"stop", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4607 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4608 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4609 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4610 if (!hldict_attr_to_str(dict, (char_u *)"term", term_attr, |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4611 sizeof(term_attr))) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4612 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4613 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4614 if (!hldict_attr_to_str(dict, (char_u *)"cterm", cterm_attr, |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4615 sizeof(cterm_attr))) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4616 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4617 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4618 ctermfg = hldict_get_string(dict, (char_u *)"ctermfg", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4619 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4620 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4621 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4622 ctermbg = hldict_get_string(dict, (char_u *)"ctermbg", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4623 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4624 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4625 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4626 ctermul = hldict_get_string(dict, (char_u *)"ctermul", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4627 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4628 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4629 |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4630 ctermfont = hldict_get_string(dict, (char_u *)"ctermfont", &error); |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4631 if (error) |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4632 return FALSE; |
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4633 |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4634 if (!hldict_attr_to_str(dict, (char_u *)"gui", gui_attr, sizeof(gui_attr))) |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4635 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4636 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4637 guifg = hldict_get_string(dict, (char_u *)"guifg", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4638 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4639 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4640 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4641 guibg = hldict_get_string(dict, (char_u *)"guibg", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4642 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4643 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4644 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4645 guisp = hldict_get_string(dict, (char_u *)"guisp", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4646 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4647 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4648 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4649 # ifdef FEAT_GUI |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4650 font = hldict_get_string(dict, (char_u *)"font", &error); |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4651 if (error) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4652 return FALSE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4653 # endif |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4654 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4655 // If none of the attributes are specified, then do nothing. |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4656 if (term_attr[0] == NUL && start == NULL && stop == NULL |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4657 && cterm_attr[0] == NUL && ctermfg == NULL && ctermbg == NULL |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4658 && ctermul == NULL && ctermfont == NULL && gui_attr[0] == NUL |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4659 # ifdef FEAT_GUI |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4660 && font == NULL |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4661 # endif |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4662 && guifg == NULL && guibg == NULL && guisp == NULL |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4663 ) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4664 return TRUE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4665 |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4666 hlsetBuf[0] = NUL; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4667 p = hlsetBuf; |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4668 if (dodefault) |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4669 p = add_attr_and_value(p, (char_u *)"default", 7, (char_u *)" "); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4670 p = add_attr_and_value(p, (char_u *)"", 0, name); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4671 p = add_attr_and_value(p, (char_u *)" term=", 6, term_attr); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4672 p = add_attr_and_value(p, (char_u *)" start=", 7, start); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4673 p = add_attr_and_value(p, (char_u *)" stop=", 6, stop); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4674 p = add_attr_and_value(p, (char_u *)" cterm=", 7, cterm_attr); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4675 p = add_attr_and_value(p, (char_u *)" ctermfg=", 9, ctermfg); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4676 p = add_attr_and_value(p, (char_u *)" ctermbg=", 9, ctermbg); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4677 p = add_attr_and_value(p, (char_u *)" ctermul=", 9, ctermul); |
34136
36843e079f64
patch 9.1.0030: Cannot use terminal alternate font
Christian Brabandt <cb@256bit.org>
parents:
34074
diff
changeset
|
4678 p = add_attr_and_value(p, (char_u *)" ctermfont=", 9, ctermfont); |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4679 p = add_attr_and_value(p, (char_u *)" gui=", 5, gui_attr); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4680 # ifdef FEAT_GUI |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4681 p = add_attr_and_value(p, (char_u *)" font=", 6, font); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4682 # endif |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4683 p = add_attr_and_value(p, (char_u *)" guifg=", 7, guifg); |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4684 p = add_attr_and_value(p, (char_u *)" guibg=", 7, guibg); |
30053
f5cbf8a4043d
patch 9.0.0364: clang static analyzer gives warnings
Bram Moolenaar <Bram@vim.org>
parents:
30011
diff
changeset
|
4685 (void)add_attr_and_value(p, (char_u *)" guisp=", 7, guisp); |
26274
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4686 |
84eb3e0ad3f4
patch 8.2.3668: messages may be corrupted
Bram Moolenaar <Bram@vim.org>
parents:
26266
diff
changeset
|
4687 do_highlight(hlsetBuf, forceit, FALSE); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4688 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4689 return TRUE; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4690 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4691 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4692 /* |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4693 * "hlset([{highlight_attr}])" function |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4694 * Add or modify highlight groups |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4695 */ |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4696 void |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4697 f_hlset(typval_T *argvars, typval_T *rettv) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4698 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4699 listitem_T *li; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4700 dict_T *dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4701 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4702 rettv->vval.v_number = -1; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4703 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4704 if (check_for_list_arg(argvars, 0) == FAIL) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4705 return; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4706 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4707 FOR_ALL_LIST_ITEMS(argvars->vval.v_list, li) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4708 { |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4709 if (li->li_tv.v_type != VAR_DICT) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4710 { |
26877
06a137af96f8
patch 8.2.3967: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
4711 emsg(_(e_dictionary_required)); |
26089
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4712 return; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4713 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4714 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4715 dict = li->li_tv.vval.v_dict; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4716 if (!hlg_add_or_update(dict)) |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4717 return; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4718 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4719 |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4720 rettv->vval.v_number = 0; |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4721 } |
c544eacaf066
patch 8.2.3578: manipulating highlighting is complicated
Bram Moolenaar <Bram@vim.org>
parents:
26059
diff
changeset
|
4722 #endif |