Skip to content

Commit 448ad2a

Browse files
authored
Merge pull request #150 from harshad1/bugfix_strcharlen_older_vim
Bugfix - strcharlen support older vim
2 parents 4ed0785 + 9f50afc commit 448ad2a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugin/bullets.vim

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,14 @@ command! InsertNewBullet call <SID>insert_new_bullet()
585585
" Helper for Colon Indent
586586
" returns 1 if current line ends in a colon, else 0
587587
fun! s:line_ends_in_colon(lnum)
588-
let l:last_char_nr = strgetchar(getline(a:lnum), strcharlen(getline(a:lnum))-1)
589-
return l:last_char_nr == 65306 || l:last_char_nr == 58
588+
let l:line = getline(a:lnum)
589+
if exists("*strcharlen") && exists("*strgetchar")
590+
let l:last_char_nr = strgetchar(l:line, strcharlen(l:line)-1)
591+
return l:last_char_nr == 65306 || l:last_char_nr == 58
592+
else
593+
" Older versions of vim do not support strchar*
594+
return l:line[strlen(l:line)-1:] ==# ':'
595+
endif
590596
endfun
591597
" --------------------------------------------------------- }}}
592598

0 commit comments

Comments
 (0)