aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/range.lua
diff options
context:
space:
mode:
authorVolodymyr Chernetskyi <volodymyr_chernetskyi@goodyear.com>2026-09-12 16:27:08 +0200
committerGitHub <noreply@github.com>2026-09-12 10:27:08 -0400
commit4ec474ed795527e96f889fc93e77714e9ed9e392 (patch)
treef4998d68a9cf2011c69a6777e484d0f7a075c9c6 /runtime/lua/vim/range.lua
parent888683ef2a90119dfcd854c71721c2cd5f454a2b (diff)
downloadrneovim-4ec474ed795527e96f889fc93e77714e9ed9e392.tar.gz
rneovim-4ec474ed795527e96f889fc93e77714e9ed9e392.tar.bz2
rneovim-4ec474ed795527e96f889fc93e77714e9ed9e392.zip
fix(range): use the preceding line for inclusive end marks #41880
Problem: Converting an exclusive end at column zero moves to the preceding row but calculates the inclusive column from the original row's text. Solution: Read the preceding line after decrementing the row. Cover adjacent lines with unequal lengths. AI-assisted
Diffstat (limited to 'runtime/lua/vim/range.lua')
-rw-r--r--runtime/lua/vim/range.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/runtime/lua/vim/range.lua b/runtime/lua/vim/range.lua
index 9f11f30d32..3ec5c2355c 100644
--- a/runtime/lua/vim/range.lua
+++ b/runtime/lua/vim/range.lua
@@ -153,6 +153,7 @@ local function to_inclusive_pos(buf, row, col)
col = col + vim.str_utf_start(line, col) - 1
elseif col == 0 and row > 0 then
row = row - 1
+ line = util.get_line(buf, row)
col = #line > 0 and #line + vim.str_utf_start(line, #line) - 1 or 0
end