aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/range.lua
diff options
context:
space:
mode:
authorVolodymyr Chernetskyi <volodymyr_chernetskyi@goodyear.com>2026-09-12 16:28:54 +0200
committerGitHub <noreply@github.com>2026-09-12 10:28:54 -0400
commit4836954b120c2dff67fe8a11322af866c0ab8504 (patch)
tree17d7705293126604251af8a9e5dcfb6d4b5e9559 /runtime/lua/vim/range.lua
parent4ec474ed795527e96f889fc93e77714e9ed9e392 (diff)
downloadrneovim-4836954b120c2dff67fe8a11322af866c0ab8504.tar.gz
rneovim-4836954b120c2dff67fe8a11322af866c0ab8504.tar.bz2
rneovim-4836954b120c2dff67fe8a11322af866c0ab8504.zip
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
Diffstat (limited to 'runtime/lua/vim/range.lua')
-rw-r--r--runtime/lua/vim/range.lua4
1 files changed, 2 insertions, 2 deletions
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