aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/diagnostic.lua
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim/diagnostic.lua')
-rw-r--r--runtime/lua/vim/diagnostic.lua4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/lua/vim/diagnostic.lua b/runtime/lua/vim/diagnostic.lua
index 1ae370e9b2..9f1e6448e6 100644
--- a/runtime/lua/vim/diagnostic.lua
+++ b/runtime/lua/vim/diagnostic.lua
@@ -867,14 +867,14 @@ local function next_diagnostic(position, search_forward, bufnr, opts, namespace)
return a.col < b.col
end
is_next = function(d)
- return math.min(d.col, line_length - 1) > position[2]
+ return math.min(d.col, math.max(line_length - 1, 0)) > position[2]
end
else
sort_diagnostics = function(a, b)
return a.col > b.col
end
is_next = function(d)
- return math.min(d.col, line_length - 1) < position[2]
+ return math.min(d.col, math.max(line_length - 1, 0)) < position[2]
end
end
table.sort(line_diagnostics[lnum], sort_diagnostics)