]> git.ipfire.org Git - thirdparty/vim.git/commit
patch 9.1.0441: getregionpos() can't properly indicate positions beyond eol v9.1.0441
authorzeertzjq <zeertzjq@outlook.com>
Fri, 24 May 2024 05:48:51 +0000 (07:48 +0200)
committerChristian Brabandt <cb@256bit.org>
Fri, 24 May 2024 05:48:51 +0000 (07:48 +0200)
commit2b09de910458247b70751928217422c38fd5abf8
treed649c131b442e7e3d3aa717ba4ca77de629748b7
parent44cadaa18c1816f7a576f1870790ee01a23c1071
patch 9.1.0441: getregionpos() can't properly indicate positions beyond eol

Problem:  getregionpos() can't properly indicate positions beyond eol.
Solution: Add an "eol" flag that enables handling positions beyond end
          of line like getpos() does (zeertzjq).

Also fix the problem that a position still has the coladd beyond the end
of the line when its column has been clamped.  In the last test case
with TABs at the end of the line the old behavior is obviously wrong.

I decided to gate this behind a flag because returning positions that
don't correspond to actual characters in the line may lead to mistakes
for callers that want to calculate the length of the selected text, so
the behavior is only enabled if the caller wants it.

closes: #14838

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
runtime/doc/builtin.txt
src/evalfunc.c
src/testdir/test_visual.vim
src/version.c