diff --git a/CHANGELOG.md b/CHANGELOG.md index 699f06c5..a4604494 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# 0.3.1-dev +# 0.3.1 - Allow using the default map but overriding or omitting a subset of the keys. - Set `completefunc` even when autocomplete is enabled. @@ -10,6 +10,8 @@ automatically. - Bug fix: Handle workspace edits that have double quotes. - Add support for `CodeAction` literals. +- Bug fix: Correctly truncate multi-byte or wide character diagnostics. +- Bug fix: Allow duplicate words in completions (overloads). # 0.3.0 diff --git a/autoload/lsc/cursor.vim b/autoload/lsc/cursor.vim index 1efae2c6..dd1b7b47 100644 --- a/autoload/lsc/cursor.vim +++ b/autoload/lsc/cursor.vim @@ -27,14 +27,19 @@ function! lsc#cursor#enableReferenceHighlights(filetype) endfunction function! lsc#cursor#showDiagnostic() abort - let diagnostic = lsc#diagnostics#underCursor() - if has_key(diagnostic, 'message') - let max_width = &columns - 18 - let message = substitute(diagnostic.message, '\n', '\\n', 'g') - if len(message) > max_width - echo message[:max_width].'...' + let l:diagnostic = lsc#diagnostics#underCursor() + if has_key(l:diagnostic, 'message') + let l:max_width = &columns - 18 + let l:message = strtrans(l:diagnostic.message) + if strdisplaywidth(l:message) > l:max_width + let l:truncated = strcharpart(l:message, 0, l:max_width) + " Trim by character until a satisfactory display width. + while strdisplaywidth(l:truncated) > l:max_width + let l:truncated = strcharpart(l:truncated, 0, strchars(l:truncated) - 1) + endwhile + echo l:truncated.'...' else - echo message + echo l:message endif else echo ''