From: sl Date: Fri, 7 Apr 2023 16:27:25 +0000 (+0200) Subject: Fixes the text_padding_left of LspDiagVirtualText messages if tab characters are... X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=81f9f918cc2ffa1c7fa2c24d74407078aa02cb74;p=vim-lsp.git Fixes the text_padding_left of LspDiagVirtualText messages if tab characters are used. --- diff --git a/autoload/lsp/diag.vim b/autoload/lsp/diag.vim index c0dffc4..df2a25e 100644 --- a/autoload/lsp/diag.vim +++ b/autoload/lsp/diag.vim @@ -137,11 +137,15 @@ def DiagsRefreshSigns(lspserver: dict, bnr: number) endif if opt.lspOptions.showDiagWithVirtualText + var padding = diag.range.start.character + if padding > 0 + padding = strdisplaywidth(getline(diag.range.start.line + 1)[ : diag.range.start.character - 1]) + endif prop_add(lnum, 0, {bufnr: bnr, type: 'LspDiagVirtualText', text: $'┌─ {diag.message}', text_align: 'above', - text_padding_left: diag.range.start.character}) + text_padding_left: padding}) endif catch /E966\|E964/ # Invalid lnum | Invalid col # Diagnostics arrive asynchronous and the document changed while they wore