aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-04-08 09:49:20 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-07-21 10:37:44 +0200
commit696e24f311acbb0ccfa1818fb016f19f0497d950 (patch)
tree8b8f670611dfafd4ac47e9043e03569dc7854b85
parent5ff90a100a2af99ee4236995bef221a41eb2f643 (diff)
downloadrneovim-696e24f311acbb0ccfa1818fb016f19f0497d950.tar.gz
rneovim-696e24f311acbb0ccfa1818fb016f19f0497d950.tar.bz2
rneovim-696e24f311acbb0ccfa1818fb016f19f0497d950.zip
highlight: extract low-level highlight logic from syntax, ui
-rw-r--r--src/nvim/api/ui.c1
-rw-r--r--src/nvim/api/vim.c1
-rw-r--r--src/nvim/buffer.c1
-rw-r--r--src/nvim/ex_cmds.c1
-rw-r--r--src/nvim/ex_getln.c1
-rw-r--r--src/nvim/highlight.c252
-rw-r--r--src/nvim/highlight.h12
-rw-r--r--src/nvim/main.c1
-rw-r--r--src/nvim/memory.c1
-rw-r--r--src/nvim/screen.c1
-rw-r--r--src/nvim/syntax.c185
-rw-r--r--src/nvim/terminal.c1
-rw-r--r--src/nvim/tui/tui.c1
-rw-r--r--src/nvim/ui.c62
14 files changed, 277 insertions, 244 deletions
diff --git a/src/nvim/api/ui.c b/src/nvim/api/ui.c
index b6e0b9a566..01e6e0ca03 100644
--- a/src/nvim/api/ui.c
+++ b/src/nvim/api/ui.c
@@ -16,6 +16,7 @@
#include "nvim/api/private/helpers.h"
#include "nvim/popupmnu.h"
#include "nvim/cursor_shape.h"
+#include "nvim/highlight.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "api/ui.c.generated.h"
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index 03567ddfd8..64d6d68c12 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -21,6 +21,7 @@
#include "nvim/vim.h"
#include "nvim/buffer.h"
#include "nvim/file_search.h"
+#include "nvim/highlight.h"
#include "nvim/window.h"
#include "nvim/types.h"
#include "nvim/ex_docmd.h"
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 81bbc56eb9..4152c16588 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -45,6 +45,7 @@
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
+#include "nvim/highlight.h"
#include "nvim/indent.h"
#include "nvim/indent_c.h"
#include "nvim/main.h"
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 115df815c6..3c6a8b1074 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -34,6 +34,7 @@
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/getchar.h"
+#include "nvim/highlight.h"
#include "nvim/indent.h"
#include "nvim/buffer_updates.h"
#include "nvim/main.h"
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 4b9ef5d819..d6f55ae7f7 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -31,6 +31,7 @@
#include "nvim/fileio.h"
#include "nvim/func_attr.h"
#include "nvim/getchar.h"
+#include "nvim/highlight.h"
#include "nvim/if_cscope.h"
#include "nvim/indent.h"
#include "nvim/main.h"
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
new file mode 100644
index 0000000000..022e086834
--- /dev/null
+++ b/src/nvim/highlight.c
@@ -0,0 +1,252 @@
+// This is an open source non-commercial project. Dear PVS-Studio, please check
+// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
+
+// highlight.c: low level code for both UI, syntax and :terminal highlighting
+
+#include "nvim/vim.h"
+#include "nvim/highlight.h"
+#include "nvim/highlight_defs.h"
+#include "nvim/map.h"
+#include "nvim/screen.h"
+#include "nvim/syntax.h"
+#include "nvim/api/private/defs.h"
+#include "nvim/api/private/helpers.h"
+
+#ifdef INCLUDE_GENERATED_DECLARATIONS
+# include "highlight.c.generated.h"
+#endif
+
+/// An attribute number is the index in attr_entries plus ATTR_OFF.
+#define ATTR_OFF 1
+
+/// Table with the specifications for an attribute number.
+/// Note that this table is used by ALL buffers. This is required because the
+/// GUI can redraw at any time for any buffer.
+static garray_T attr_table = GA_EMPTY_INIT_VALUE;
+
+static inline HlAttrs * ATTR_ENTRY(int idx)
+{
+ return &((HlAttrs *)attr_table.ga_data)[idx];
+}
+
+
+/// Return the attr number for a set of colors and font.
+/// Add a new entry to the term_attr_table, attr_table or gui_attr_table
+/// if the combination is new.
+/// @return 0 for error.
+int get_attr_entry(HlAttrs *aep)
+{
+ garray_T *table = &attr_table;
+ HlAttrs *taep;
+ static int recursive = false;
+
+ /*
+ * Init the table, in case it wasn't done yet.
+ */
+ table->ga_itemsize = sizeof(HlAttrs);
+ ga_set_growsize(table, 7);
+
+ // Try to find an entry with the same specifications.
+ for (int i = 0; i < table->ga_len; i++) {
+ taep = &(((HlAttrs *)table->ga_data)[i]);
+ if (aep->cterm_ae_attr == taep->cterm_ae_attr
+ && aep->cterm_fg_color == taep->cterm_fg_color
+ && aep->cterm_bg_color == taep->cterm_bg_color
+ && aep->rgb_ae_attr == taep->rgb_ae_attr
+ && aep->rgb_fg_color == taep->rgb_fg_color
+ && aep->rgb_bg_color == taep->rgb_bg_color
+ && aep->rgb_sp_color == taep->rgb_sp_color) {
+ return i + ATTR_OFF;
+ }
+ }
+
+ if (table->ga_len + ATTR_OFF > MAX_TYPENR) {
+ /*
+ * Running out of attribute entries! remove all attributes, and
+ * compute new ones for all groups.
+ * When called recursively, we are really out of numbers.
+ */
+ if (recursive) {
+ EMSG(_("E424: Too many different highlighting attributes in use"));
+ return 0;
+ }
+ recursive = TRUE;
+
+ clear_hl_tables();
+
+ must_redraw = CLEAR;
+
+ highlight_attr_set_all();
+
+ recursive = FALSE;
+ }
+
+ // This is a new combination of colors and font, add an entry.
+ taep = GA_APPEND_VIA_PTR(HlAttrs, table);
+ memset(taep, 0, sizeof(*taep));
+ taep->cterm_ae_attr = aep->cterm_ae_attr;
+ taep->cterm_fg_color = aep->cterm_fg_color;
+ taep->cterm_bg_color = aep->cterm_bg_color;
+ taep->rgb_ae_attr = aep->rgb_ae_attr;
+ taep->rgb_fg_color = aep->rgb_fg_color;
+ taep->rgb_bg_color = aep->rgb_bg_color;
+ taep->rgb_sp_color = aep->rgb_sp_color;
+
+ return table->ga_len - 1 + ATTR_OFF;
+}
+
+// Clear all highlight tables.
+void clear_hl_tables(void)
+{
+ ga_clear(&attr_table);
+}
+
+// Combine special attributes (e.g., for spelling) with other attributes
+// (e.g., for syntax highlighting).
+// "prim_attr" overrules "char_attr".
+// This creates a new group when required.
+// Since we expect there to be few spelling mistakes we don't cache the
+// result.
+// Return the resulting attributes.
+int hl_combine_attr(int char_attr, int prim_attr)
+{
+ HlAttrs *char_aep = NULL;
+ HlAttrs *spell_aep;
+ HlAttrs new_en = HLATTRS_INIT;
+
+ if (char_attr == 0) {
+ return prim_attr;
+ }
+
+ if (prim_attr == 0) {
+ return char_attr;
+ }
+
+ // Find the entry for char_attr
+ char_aep = syn_cterm_attr2entry(char_attr);
+
+ if (char_aep != NULL) {
+ // Copy all attributes from char_aep to the new entry
+ new_en = *char_aep;
+ }
+
+ spell_aep = syn_cterm_attr2entry(prim_attr);
+ if (spell_aep != NULL) {
+ new_en.cterm_ae_attr |= spell_aep->cterm_ae_attr;
+ new_en.rgb_ae_attr |= spell_aep->rgb_ae_attr;
+
+ if (spell_aep->cterm_fg_color > 0) {
+ new_en.cterm_fg_color = spell_aep->cterm_fg_color;
+ }
+
+ if (spell_aep->cterm_bg_color > 0) {
+ new_en.cterm_bg_color = spell_aep->cterm_bg_color;
+ }
+
+ if (spell_aep->rgb_fg_color >= 0) {
+ new_en.rgb_fg_color = spell_aep->rgb_fg_color;
+ }
+
+ if (spell_aep->rgb_bg_color >= 0) {
+ new_en.rgb_bg_color = spell_aep->rgb_bg_color;
+ }
+
+ if (spell_aep->rgb_sp_color >= 0) {
+ new_en.rgb_sp_color = spell_aep->rgb_sp_color;
+ }
+ }
+ return get_attr_entry(&new_en);
+}
+
+/// \note this function does not apply exclusively to cterm attr contrary
+/// to what its name implies
+/// \warn don't call it with attr 0 (i.e., the null attribute)
+HlAttrs *syn_cterm_attr2entry(int attr)
+{
+ attr -= ATTR_OFF;
+ if (attr >= attr_table.ga_len) {
+ // did ":syntax clear"
+ return NULL;
+ }
+ return ATTR_ENTRY(attr);
+}
+
+/// Gets highlight description for id `attr_id` as a map.
+Dictionary hl_get_attr_by_id(Integer attr_id, Boolean rgb, Error *err)
+{
+ HlAttrs *aep = NULL;
+ Dictionary dic = ARRAY_DICT_INIT;
+
+ if (attr_id == 0) {
+ return dic;
+ }
+
+ aep = syn_cterm_attr2entry((int)attr_id);
+ if (!aep) {
+ api_set_error(err, kErrorTypeException,
+ "Invalid attribute id: %" PRId64, attr_id);
+ return dic;
+ }
+
+ return hlattrs2dict(aep, rgb);
+}
+
+/// Converts an HlAttrs into Dictionary
+///
+/// @param[in] aep data to convert
+/// @param use_rgb use 'gui*' settings if true, else resorts to 'cterm*'
+Dictionary hlattrs2dict(const HlAttrs *aep, bool use_rgb)
+{
+ assert(aep);
+ Dictionary hl = ARRAY_DICT_INIT;
+ int mask = use_rgb ? aep->rgb_ae_attr : aep->cterm_ae_attr;
+
+ if (mask & HL_BOLD) {
+ PUT(hl, "bold", BOOLEAN_OBJ(true));
+ }
+
+ if (mask & HL_STANDOUT) {
+ PUT(hl, "standout", BOOLEAN_OBJ(true));
+ }
+
+ if (mask & HL_UNDERLINE) {
+ PUT(hl, "underline", BOOLEAN_OBJ(true));
+ }
+
+ if (mask & HL_UNDERCURL) {
+ PUT(hl, "undercurl", BOOLEAN_OBJ(true));
+ }
+
+ if (mask & HL_ITALIC) {
+ PUT(hl, "italic", BOOLEAN_OBJ(true));
+ }
+
+ if (mask & HL_INVERSE) {
+ PUT(hl, "reverse", BOOLEAN_OBJ(true));
+ }
+
+ if (use_rgb) {
+ if (aep->rgb_fg_color != -1) {
+ PUT(hl, "foreground", INTEGER_OBJ(aep->rgb_fg_color));
+ }
+
+ if (aep->rgb_bg_color != -1) {
+ PUT(hl, "background", INTEGER_OBJ(aep->rgb_bg_color));
+ }
+
+ if (aep->rgb_sp_color != -1) {
+ PUT(hl, "special", INTEGER_OBJ(aep->rgb_sp_color));
+ }
+ } else {
+ if (cterm_normal_fg_color != aep->cterm_fg_color) {
+ PUT(hl, "foreground", INTEGER_OBJ(aep->cterm_fg_color - 1));
+ }
+
+ if (cterm_normal_bg_color != aep->cterm_bg_color) {
+ PUT(hl, "background", INTEGER_OBJ(aep->cterm_bg_color - 1));
+ }
+ }
+
+ return hl;
+}
+
diff --git a/src/nvim/highlight.h b/src/nvim/highlight.h
new file mode 100644
index 0000000000..3bb5600b4f
--- /dev/null
+++ b/src/nvim/highlight.h
@@ -0,0 +1,12 @@
+#ifndef NVIM_HIGHLIGHT_H
+#define NVIM_HIGHLIGHT_H
+
+#include <stdbool.h>
+#include "nvim/highlight_defs.h"
+#include "nvim/api/private/defs.h"
+
+#ifdef INCLUDE_GENERATED_DECLARATIONS
+# include "highlight.h.generated.h"
+#endif
+
+#endif // NVIM_HIGHLIGHT_H
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 6b382ae320..460711cd36 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -23,6 +23,7 @@
#include "nvim/fold.h"
#include "nvim/getchar.h"
#include "nvim/hashtab.h"
+#include "nvim/highlight.h"
#include "nvim/iconv.h"
#include "nvim/if_cscope.h"
#ifdef HAVE_LOCALE_H
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index b2aef13946..82367fbff8 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -10,6 +10,7 @@
#include "nvim/vim.h"
#include "nvim/eval.h"
+#include "nvim/highlight.h"
#include "nvim/memfile.h"
#include "nvim/memory.h"
#include "nvim/message.h"
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 49aeaff3a6..bc7cd5f541 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -85,6 +85,7 @@
#include "nvim/fold.h"
#include "nvim/indent.h"
#include "nvim/getchar.h"
+#include "nvim/highlight.h"
#include "nvim/main.h"
#include "nvim/mark.h"
#include "nvim/mbyte.h"
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 87b2fe24a4..44cd3cdeac 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -22,6 +22,7 @@
#include "nvim/fileio.h"
#include "nvim/fold.h"
#include "nvim/hashtab.h"
+#include "nvim/highlight.h"
#include "nvim/indent_c.h"
#include "nvim/mbyte.h"
#include "nvim/memline.h"
@@ -42,7 +43,6 @@
#include "nvim/ui.h"
#include "nvim/os/os.h"
#include "nvim/os/time.h"
-#include "nvim/api/private/helpers.h"
#include "nvim/buffer.h"
static bool did_syntax_onoff = false;
@@ -216,12 +216,6 @@ struct name_list {
# include "syntax.c.generated.h"
#endif
-/*
- * An attribute number is the index in attr_table plus ATTR_OFF.
- */
-#define ATTR_OFF 1
-
-
static char *(spo_name_tab[SPO_COUNT]) =
{"ms=", "me=", "hs=", "he=", "rs=", "re=", "lc="};
@@ -7001,161 +6995,6 @@ static void highlight_clear(int idx)
}
-/// Table with the specifications for an attribute number.
-/// Note that this table is used by ALL buffers. This is required because the
-/// GUI can redraw at any time for any buffer.
-static garray_T attr_table = GA_EMPTY_INIT_VALUE;
-
-static inline HlAttrs * ATTR_ENTRY(int idx)
-{
- return &((HlAttrs *)attr_table.ga_data)[idx];
-}
-
-
-/// Return the attr number for a set of colors and font.
-/// Add a new entry to the term_attr_table, attr_table or gui_attr_table
-/// if the combination is new.
-/// @return 0 for error.
-int get_attr_entry(HlAttrs *aep)
-{
- garray_T *table = &attr_table;
- HlAttrs *taep;
- static int recursive = false;
-
- /*
- * Init the table, in case it wasn't done yet.
- */
- table->ga_itemsize = sizeof(HlAttrs);
- ga_set_growsize(table, 7);
-
- // Try to find an entry with the same specifications.
- for (int i = 0; i < table->ga_len; i++) {
- taep = &(((HlAttrs *)table->ga_data)[i]);
- if (aep->cterm_ae_attr == taep->cterm_ae_attr
- && aep->cterm_fg_color == taep->cterm_fg_color
- && aep->cterm_bg_color == taep->cterm_bg_color
- && aep->rgb_ae_attr == taep->rgb_ae_attr
- && aep->rgb_fg_color == taep->rgb_fg_color
- && aep->rgb_bg_color == taep->rgb_bg_color
- && aep->rgb_sp_color == taep->rgb_sp_color) {
- return i + ATTR_OFF;
- }
- }
-
- if (table->ga_len + ATTR_OFF > MAX_TYPENR) {
- /*
- * Running out of attribute entries! remove all attributes, and
- * compute new ones for all groups.
- * When called recursively, we are really out of numbers.
- */
- if (recursive) {
- EMSG(_("E424: Too many different highlighting attributes in use"));
- return 0;
- }
- recursive = TRUE;
-
- clear_hl_tables();
-
- must_redraw = CLEAR;
-
- for (int i = 0; i < highlight_ga.ga_len; ++i) {
- set_hl_attr(i);
- }
-
- recursive = FALSE;
- }
-
-
- // This is a new combination of colors and font, add an entry.
- taep = GA_APPEND_VIA_PTR(HlAttrs, table);
- memset(taep, 0, sizeof(*taep));
- taep->cterm_ae_attr = aep->cterm_ae_attr;
- taep->cterm_fg_color = aep->cterm_fg_color;
- taep->cterm_bg_color = aep->cterm_bg_color;
- taep->rgb_ae_attr = aep->rgb_ae_attr;
- taep->rgb_fg_color = aep->rgb_fg_color;
- taep->rgb_bg_color = aep->rgb_bg_color;
- taep->rgb_sp_color = aep->rgb_sp_color;
-
- return table->ga_len - 1 + ATTR_OFF;
-}
-
-// Clear all highlight tables.
-void clear_hl_tables(void)
-{
- ga_clear(&attr_table);
-}
-
-// Combine special attributes (e.g., for spelling) with other attributes
-// (e.g., for syntax highlighting).
-// "prim_attr" overrules "char_attr".
-// This creates a new group when required.
-// Since we expect there to be few spelling mistakes we don't cache the
-// result.
-// Return the resulting attributes.
-int hl_combine_attr(int char_attr, int prim_attr)
-{
- HlAttrs *char_aep = NULL;
- HlAttrs *spell_aep;
- HlAttrs new_en = HLATTRS_INIT;
-
- if (char_attr == 0) {
- return prim_attr;
- }
-
- if (prim_attr == 0) {
- return char_attr;
- }
-
- // Find the entry for char_attr
- char_aep = syn_cterm_attr2entry(char_attr);
-
- if (char_aep != NULL) {
- // Copy all attributes from char_aep to the new entry
- new_en = *char_aep;
- }
-
- spell_aep = syn_cterm_attr2entry(prim_attr);
- if (spell_aep != NULL) {
- new_en.cterm_ae_attr |= spell_aep->cterm_ae_attr;
- new_en.rgb_ae_attr |= spell_aep->rgb_ae_attr;
-
- if (spell_aep->cterm_fg_color > 0) {
- new_en.cterm_fg_color = spell_aep->cterm_fg_color;
- }
-
- if (spell_aep->cterm_bg_color > 0) {
- new_en.cterm_bg_color = spell_aep->cterm_bg_color;
- }
-
- if (spell_aep->rgb_fg_color >= 0) {
- new_en.rgb_fg_color = spell_aep->rgb_fg_color;
- }
-
- if (spell_aep->rgb_bg_color >= 0) {
- new_en.rgb_bg_color = spell_aep->rgb_bg_color;
- }
-
- if (spell_aep->rgb_sp_color >= 0) {
- new_en.rgb_sp_color = spell_aep->rgb_sp_color;
- }
- }
- return get_attr_entry(&new_en);
-}
-
-/// \note this function does not apply exclusively to cterm attr contrary
-/// to what its name implies
-/// \warn don't call it with attr 0 (i.e., the null attribute)
-HlAttrs *syn_cterm_attr2entry(int attr)
-{
- attr -= ATTR_OFF;
- if (attr >= attr_table.ga_len) {
- // did ":syntax clear"
- return NULL;
- }
- return ATTR_ENTRY(attr);
-}
-
/// \addtogroup LIST_XXX
/// @{
#define LIST_ATTR 1
@@ -7590,7 +7429,7 @@ int syn_get_final_id(int hl_id)
}
/// Refresh the color attributes of all highlight groups.
-static void highlight_attr_set_all(void)
+void highlight_attr_set_all(void)
{
for (int idx = 0; idx < highlight_ga.ga_len; idx++) {
struct hl_group *sgp = &HL_TABLE()[idx];
@@ -8522,26 +8361,6 @@ RgbValue name_to_color(const char_u *name)
return -1;
}
-/// Gets highlight description for id `attr_id` as a map.
-Dictionary hl_get_attr_by_id(Integer attr_id, Boolean rgb, Error *err)
-{
- HlAttrs *aep = NULL;
- Dictionary dic = ARRAY_DICT_INIT;
-
- if (attr_id == 0) {
- return dic;
- }
-
- aep = syn_cterm_attr2entry((int)attr_id);
- if (!aep) {
- api_set_error(err, kErrorTypeException,
- "Invalid attribute id: %" PRId64, attr_id);
- return dic;
- }
-
- return hlattrs2dict(aep, rgb);
-}
-
/**************************************
* End of Highlighting stuff *
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index 6907529726..7c90d77c1c 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -49,6 +49,7 @@
#include "nvim/message.h"
#include "nvim/memory.h"
#include "nvim/option.h"
+#include "nvim/highlight.h"
#include "nvim/macros.h"
#include "nvim/mbyte.h"
#include "nvim/buffer.h"
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index f41c715696..4849a47144 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -20,6 +20,7 @@
#include "nvim/vim.h"
#include "nvim/log.h"
#include "nvim/ui.h"
+#include "nvim/highlight.h"
#include "nvim/map.h"
#include "nvim/main.h"
#include "nvim/memory.h"
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index 3b632ace41..377e011d49 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -32,7 +32,7 @@
#include "nvim/os/signal.h"
#include "nvim/popupmnu.h"
#include "nvim/screen.h"
-#include "nvim/syntax.h"
+#include "nvim/highlight.h"
#include "nvim/window.h"
#include "nvim/cursor_shape.h"
#ifdef FEAT_TUI
@@ -172,66 +172,6 @@ void ui_event(char *name, Array args)
}
-/// Converts an HlAttrs into Dictionary
-///
-/// @param[in] aep data to convert
-/// @param use_rgb use 'gui*' settings if true, else resorts to 'cterm*'
-Dictionary hlattrs2dict(const HlAttrs *aep, bool use_rgb)
-{
- assert(aep);
- Dictionary hl = ARRAY_DICT_INIT;
- int mask = use_rgb ? aep->rgb_ae_attr : aep->cterm_ae_attr;
-
- if (mask & HL_BOLD) {
- PUT(hl, "bold", BOOLEAN_OBJ(true));
- }
-
- if (mask & HL_STANDOUT) {
- PUT(hl, "standout", BOOLEAN_OBJ(true));
- }
-
- if (mask & HL_UNDERLINE) {
- PUT(hl, "underline", BOOLEAN_OBJ(true));
- }
-
- if (mask & HL_UNDERCURL) {
- PUT(hl, "undercurl", BOOLEAN_OBJ(true));
- }
-
- if (mask & HL_ITALIC) {
- PUT(hl, "italic", BOOLEAN_OBJ(true));
- }
-
- if (mask & HL_INVERSE) {
- PUT(hl, "reverse", BOOLEAN_OBJ(true));
- }
-
-
- if (use_rgb) {
- if (aep->rgb_fg_color != -1) {
- PUT(hl, "foreground", INTEGER_OBJ(aep->rgb_fg_color));
- }
-
- if (aep->rgb_bg_color != -1) {
- PUT(hl, "background", INTEGER_OBJ(aep->rgb_bg_color));
- }
-
- if (aep->rgb_sp_color != -1) {
- PUT(hl, "special", INTEGER_OBJ(aep->rgb_sp_color));
- }
- } else {
- if (cterm_normal_fg_color != aep->cterm_fg_color) {
- PUT(hl, "foreground", INTEGER_OBJ(aep->cterm_fg_color - 1));
- }
-
- if (cterm_normal_bg_color != aep->cterm_bg_color) {
- PUT(hl, "background", INTEGER_OBJ(aep->cterm_bg_color - 1));
- }
- }
-
- return hl;
-}
-
void ui_refresh(void)
{
if (!ui_active()) {