From 9e83f243e7d743bb763601f450521f861aa31d33 Mon Sep 17 00:00:00 2001 From: Marco Hinz Date: Sun, 29 Dec 2013 19:17:56 +0100 Subject: [PATCH] Fix unicode + subscripting bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This bug happened when a unicode character was used for the delete sign. Prior to this patch we used string subscripting which worked fine for ASCII characters, but see yourself: :echo '«5'[-2:] --- autoload/sy/sign.vim | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/autoload/sy/sign.vim b/autoload/sy/sign.vim index 9a6c828..0fc02a4 100644 --- a/autoload/sy/sign.vim +++ b/autoload/sy/sign.vim @@ -43,7 +43,8 @@ function! sy#sign#set(signs) call add(hunk.ids, g:id_top) if sign.type == 'SignifyDelete' - execute 'sign define SignifyDelete'. sign.count .' text='. (s:sign_delete . sign.count)[-2:] .' texthl=SignifySignDelete linehl='. s:delete_highlight[g:signify_line_highlight] + let sygn = (sign.count > 9) ? string(sign.count)[-2:] : (s:sign_delete . sign.count) + execute 'sign define SignifyDelete'. sign.count .' text='. sygn .' texthl=SignifySignDelete linehl='. s:delete_highlight[g:signify_line_highlight] execute 'sign place' g:id_top 'line='. sign.lnum 'name='. sign.type . sign.count 'buffer='. b:sy.buffer else execute 'sign place' g:id_top 'line='. sign.lnum 'name='. sign.type 'buffer='. b:sy.buffer