From 6ce4e0e6fee3f30210e1fc22a796f1e95c3774e6 Mon Sep 17 00:00:00 2001 From: Reed Date: Tue, 2 Feb 2021 05:58:16 -0600 Subject: [PATCH] fix (layer): Remove error when file name contains curly brace (#4065) eval() in the len() function now evals from the 3rd character to the character before the first right hand curly brace Regarding issue #3976 --- autoload/SpaceVim/api/vim/statusline.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/api/vim/statusline.vim b/autoload/SpaceVim/api/vim/statusline.vim index be1d575d4..91871f203 100644 --- a/autoload/SpaceVim/api/vim/statusline.vim +++ b/autoload/SpaceVim/api/vim/statusline.vim @@ -25,7 +25,8 @@ let s:self.__bufnr = -1 function! s:self.len(sec) abort let str = matchstr(a:sec, '%{.*}') if !empty(str) - return len(a:sec) - len(str) + len(eval(str[2:-2])) + 4 + let pos = match(str, '}') + return len(a:sec) - len(str) + len(eval(str[2:pos-1])) + 4 else return len(a:sec) + 4 endif