branch: allow multibyte chars in shortening algorithm

previously, the branch extension used name[0:6], however that would
break with multibyte characters, since this is a byte index and not a
character index.

fixes #1686
This commit is contained in:
Christian Brabandt 2018-03-14 21:33:25 +01:00
parent 958f78335e
commit 4237bfb052
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09

View File

@ -113,7 +113,7 @@ function! s:display_git_branch()
if ref !~ "^fatal: no tag exactly matches"
let name = s:format_name(substitute(ref, '\v\C^%(heads/|remotes/|tags/)=','',''))."(".name.")"
else
let name = commit[0:s:sha1size-1]."(".name.")"
let name = matchstr(commit, '.\{'.s:sha1size.'}')."(".name.")"
endif
endif
catch