Ensure signs are only padded when 1 display cell

This commit is contained in:
Ben Jackson 2020-08-23 12:52:03 +01:00
commit dae5760900
3 changed files with 22 additions and 4 deletions

View file

@ -777,3 +777,13 @@ def WindowID( window, tab=None ):
if tab is None:
tab = window.tabpage
return int( Call( 'win_getid', window.number, tab.number ) )
def DefineSign( name, text, texthl, col = 'right' ):
if col == 'right':
if int( Call( 'strdisplaywidth', text ) ) < 2:
text = ' ' + text
text = text.replace( ' ', r'\ ' )
vim.command( f'sign define { name } text={ text } texthl={ texthl }' )