aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/syntax.c
diff options
context:
space:
mode:
authorStéphane Campinas <stephane.campinas@gmail.com>2016-09-10 20:35:47 +0100
committerJustin M. Keyes <justinkz@gmail.com>2016-09-16 14:00:10 +0200
commitbc1a5db6cc103f125a3705970d0018fb145aca4a (patch)
tree1199832617fddcbd61f6c2f3c8e523ff437a2665 /src/nvim/syntax.c
parent6e9f329d051cf6bf6d83dbe5335f86a1752ec45a (diff)
downloadrneovim-bc1a5db6cc103f125a3705970d0018fb145aca4a.tar.gz
rneovim-bc1a5db6cc103f125a3705970d0018fb145aca4a.tar.bz2
rneovim-bc1a5db6cc103f125a3705970d0018fb145aca4a.zip
vim-patch:7.4.1547 #5326
Problem: Getting a cterm highlight attribute that is not set results in the string "-1". Solution: Return an empty string. (Taro Muraoka) https://github.com/vim/vim/commit/385111bd86e0b38667879c3e89506ca1ae98e1df
Diffstat (limited to 'src/nvim/syntax.c')
-rw-r--r--src/nvim/syntax.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index c753c6fabd..6fd7603629 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -7001,11 +7001,15 @@ highlight_color (
if (font || sp)
return NULL;
if (modec == 'c') {
- if (fg)
+ if (fg) {
n = HL_TABLE()[id - 1].sg_cterm_fg - 1;
- else
+ } else {
n = HL_TABLE()[id - 1].sg_cterm_bg - 1;
- sprintf((char *)name, "%d", n);
+ }
+ if (n < 0) {
+ return NULL;
+ }
+ snprintf((char *)name, sizeof(name), "%d", n);
return name;
}
/* term doesn't have color */