foldtext() fixed

This commit is contained in:
ManjaroOne666 2018-09-24 18:41:34 +01:00
parent fed62ab5ab
commit a1c8fd1d75
1 changed files with 9 additions and 2 deletions

View File

@ -95,14 +95,21 @@ function! MyFoldText()
let l:line = getline(v:foldstart) let l:line = getline(v:foldstart)
let l:postfix = ' +' . l:linecount . ' ' . v:folddashes . '|' let l:postfix = ' +' . l:linecount . ' ' . v:folddashes . '|'
while len(l:postfix) < 11
let l:postfix = ' ' . l:postfix
endwhile
" unicode characters counted as 2 digits in length - TODO find fix " unicode characters counted as 2 digits in length - TODO find fix
" checkout strlen
" let l:postfix = ' •••••••••••• +' . l:linecount . ' ' . v:folddashes . '|' " let l:postfix = ' •••••••••••• +' . l:linecount . ' ' . v:folddashes . '|'
let l:len_line = len(l:line) let l:len_line = len(l:line)
let l:len_postfix = len(l:postfix) let l:len_postfix = len(l:postfix)
if l:len_line + l:len_postfix <= 80 if l:len_line + l:len_postfix <= 80
let l:padding = ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'[0:79 - l:len_line - l:len_postfix] let l:padding = ' ' . ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'[l:len_line + l:len_postfix + 4:79]
if l:padding[:-1] !== '-'
let l:padding = ' ' . l:padding [0:-1]
endif
let l:foldtext = l:line . l:padding . l:postfix let l:foldtext = l:line . l:padding . l:postfix
else else
let l:foldtext = l:line[:76 - l:len_postfix] . '...' . l:postfix let l:foldtext = l:line[:76 - l:len_postfix] . '...' . l:postfix