mirror of
https://github.com/neovim/neovim.git
synced 2026-02-05 03:51:21 +10:00
problem: can we have Serde?
solution: we have Serde at home
This by itself is just a change of notation, that could be quickly
merged to avoid messy merge conflicts, but upcoming changes are planned:
- keysets no longer need to be defined in one single file. `keysets.h` is
just the initial automatic conversion of the previous `keysets.lua`.
keysets just used in a single api/{scope}.h can be moved to that file, later on.
- Typed dicts will have more specific types than Object. this will
enable most of the existing manual typechecking boilerplate to be eliminated.
We will need some annotation for missing value, i e a boolean will
need to be represented as a TriState (none/false/true) in some cases.
- Eventually: optional parameters in form of a `Dict opts` final
parameter will get added in some form to metadata. this will require
a discussion/desicion about type forward compatibility.
35 lines
932 B
C
35 lines
932 B
C
#ifndef NVIM_HIGHLIGHT_H
|
|
#define NVIM_HIGHLIGHT_H
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "nvim/api/keysets.h"
|
|
#include "nvim/api/private/defs.h"
|
|
#include "nvim/buffer_defs.h"
|
|
#include "nvim/highlight_defs.h"
|
|
#include "nvim/option_defs.h"
|
|
#include "nvim/ui.h"
|
|
|
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
|
# include "highlight.h.generated.h"
|
|
#endif
|
|
|
|
static inline int win_hl_attr(win_T *wp, int hlf)
|
|
{
|
|
// wp->w_ns_hl_attr might be null if we check highlights
|
|
// prior to entering redraw
|
|
return ((wp->w_ns_hl_attr && ns_hl_fast < 0) ? wp->w_ns_hl_attr : hl_attr_active)[hlf];
|
|
}
|
|
|
|
#define HLATTRS_DICT_SIZE 16
|
|
|
|
#define HL_SET_DEFAULT_COLORS(rgb_fg, rgb_bg, rgb_sp) \
|
|
do { \
|
|
bool dark_ = (*p_bg == 'd'); \
|
|
rgb_fg = rgb_fg != -1 ? rgb_fg : (dark_ ? 0xFFFFFF : 0x000000); \
|
|
rgb_bg = rgb_bg != -1 ? rgb_bg : (dark_ ? 0x000000 : 0xFFFFFF); \
|
|
rgb_sp = rgb_sp != -1 ? rgb_sp : 0xFF0000; \
|
|
} while (0);
|
|
|
|
#endif // NVIM_HIGHLIGHT_H
|