From 4836954b120c2dff67fe8a11322af866c0ab8504 Mon Sep 17 00:00:00 2001 From: Volodymyr Chernetskyi Date: Sat, 12 Sep 2026 16:28:54 +0200 Subject: fix(range): preserve single-character intersections #41881 Problem: Intersection rejects ranges whose inclusive end equals the other start, discarding a shared character and even a one-character self-intersection. Solution: Use strict comparisons when checking inclusive ends for non-overlap. Cover two ranges that share a single character. AI-assisted --- runtime/lua/vim/range.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/range.lua') diff --git a/runtime/lua/vim/range.lua b/runtime/lua/vim/range.lua index 3ec5c2355c..ac443c3c5d 100644 --- a/runtime/lua/vim/range.lua +++ b/runtime/lua/vim/range.lua @@ -272,8 +272,8 @@ function M.intersect(r1, r2) local r2_inclusive_end_row, r2_inclusive_end_col = to_inclusive_pos(r2.buf, r2[3], r2[4]) if - util.cmp_pos.le(r1_inclusive_end_row, r1_inclusive_end_col, r2[1], r2[2]) - or util.cmp_pos.ge(r1[1], r1[2], r2_inclusive_end_row, r2_inclusive_end_col) + util.cmp_pos.lt(r1_inclusive_end_row, r1_inclusive_end_col, r2[1], r2[2]) + or util.cmp_pos.gt(r1[1], r1[2], r2_inclusive_end_row, r2_inclusive_end_col) then return nil end -- cgit