neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 9641ad9369f66c9e30114a57914672eb2ca96d51
parent 3991f146215ba974fad0ef22beb21e6c95e30138
Author: Sergei Slipchenko <faergeek@gmail.com>
Date:   Tue,  3 Jun 2025 18:22:36 +0400

fix(diagnostics): diagnostic just after EOL is not highlighted #34085

Fixes #34013

Problem:
when diagnostic is set right after EOL, underline handler looks
inconsistent compared to other handlers, visually underline is shown
starting from the next line. On top of that it's also inconsistent with
open_float and jump.

Solution:
clamp starting column position in underline handler to be right before
EOL to make it visible and consistent with other handlers, open_float
and jump.
Diffstat:
Mruntime/lua/vim/diagnostic.lua | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua @@ -1581,11 +1581,14 @@ M.handlers.underline = { end end + local lines = + vim.api.nvim_buf_get_lines(diagnostic.bufnr, diagnostic.lnum, diagnostic.lnum + 1, true) + vim.hl.range( bufnr, underline_ns, higroup, - { diagnostic.lnum, diagnostic.col }, + { diagnostic.lnum, math.min(diagnostic.col, #lines[1] - 1) }, { diagnostic.end_lnum, diagnostic.end_col }, { priority = get_priority(diagnostic.severity) } )