From 4237bfb052ae81f71461e834ead51e61f06b6385 Mon Sep 17 00:00:00 2001 From: Christian Brabandt Date: Wed, 14 Mar 2018 21:33:25 +0100 Subject: [PATCH] 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 --- autoload/airline/extensions/branch.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/airline/extensions/branch.vim b/autoload/airline/extensions/branch.vim index 0f5f2f8..738ec3f 100644 --- a/autoload/airline/extensions/branch.vim +++ b/autoload/airline/extensions/branch.vim @@ -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