Fix unicode + subscripting bug

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:]
This commit is contained in:
Marco Hinz 2013-12-29 19:17:56 +01:00
parent a4e06fb303
commit 9e83f243e7

View File

@ -43,7 +43,8 @@ function! sy#sign#set(signs)
call add(hunk.ids, g:id_top) call add(hunk.ids, g:id_top)
if sign.type == 'SignifyDelete' 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 execute 'sign place' g:id_top 'line='. sign.lnum 'name='. sign.type . sign.count 'buffer='. b:sy.buffer
else else
execute 'sign place' g:id_top 'line='. sign.lnum 'name='. sign.type 'buffer='. b:sy.buffer execute 'sign place' g:id_top 'line='. sign.lnum 'name='. sign.type 'buffer='. b:sy.buffer