aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/highlight.c
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2022-02-21 20:17:36 +0000
committerGitHub <noreply@github.com>2022-02-21 13:17:36 -0700
commit1e7cb2dcd975aadeb91b913f117b21c7775c3374 (patch)
treeb3722c65ecf7062cdfd5d80df98c19fbf80d3c42 /src/nvim/highlight.c
parentfc7fc14bd2ab1090bd97d1836d3a472ad0ce4f97 (diff)
downloadrneovim-1e7cb2dcd975aadeb91b913f117b21c7775c3374.tar.gz
rneovim-1e7cb2dcd975aadeb91b913f117b21c7775c3374.tar.bz2
rneovim-1e7cb2dcd975aadeb91b913f117b21c7775c3374.zip
fix(highlight): accept NONE as a color name (#17487)
... for when `ns=0`. Also update the documentation of nvim_set_hl to clarify the set behaviour. Fixes #17478
Diffstat (limited to 'src/nvim/highlight.c')
-rw-r--r--src/nvim/highlight.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index 8b998ff62e..bbad27014d 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -927,10 +927,11 @@ int object_to_color(Object val, char *key, bool rgb, Error *err)
} else if (val.type == kObjectTypeString) {
String str = val.data.string;
// TODO(bfredl): be more fancy with "bg", "fg" etc
+ if (!str.size || STRICMP(str.data, "NONE") == 0) {
+ return -1;
+ }
int color;
- if (!str.size) {
- color = 0;
- } else if (rgb) {
+ if (rgb) {
color = name_to_color(str.data);
} else {
color = name_to_ctermcolor(str.data);