Skip to content

Commit 3deb1fb

Browse files
zbinlinprabirshrestha
authored andcommitted
Fix echo diagnostics truncation (#379)
In multiple vertical split windows, diagnostics message echo in statusline is too short, this patch will check multiple windows and fix it.
1 parent e346c77 commit 3deb1fb

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

autoload/lsp/utils.vim

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,19 @@ endfunction
164164

165165
function! lsp#utils#echo_with_truncation(msg) abort
166166
let l:msg = a:msg
167-
let l:winwidth = winwidth(0)
168167

169-
if &showcmd
170-
let l:winwidth -= 11
168+
if &laststatus == 0 || (&laststatus == 1 && tabpagewinnr(tabpagenr(), '$') == 1)
169+
let l:winwidth = winwidth(0)
170+
171+
if &ruler
172+
let l:winwidth -= 18
173+
endif
174+
else
175+
let l:winwidth = &columns
171176
endif
172177

173-
if &laststatus != 2 && &ruler
174-
let l:winwidth -= 18
178+
if &showcmd
179+
let l:winwidth -= 11
175180
endif
176181

177182
if l:winwidth > 5 && l:winwidth < strdisplaywidth(l:msg)

0 commit comments

Comments
 (0)