summaryrefslogtreecommitdiffstats
path: root/src/ops.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-05-22 16:42:44 +0200
committerChristian Brabandt <cb@256bit.org>2024-05-22 16:42:44 +0200
commit52a6f348874778cf315b47d9e8b5f818f4b97277 (patch)
tree9445db2ad79338de8626f28b473892cc24ff189d /src/ops.c
parent95ff39f8e3d5e16d4ef55f47d8f50da29df05f9e (diff)
patch 9.1.0430: getregionpos() doesn't handle one char selectionv9.1.0430
Problem: getregionpos() doesn't handle one char selection. Solution: Handle startspaces differently when is_oneChar is set. Also add a test for an exclusive charwise selection with multibyte chars (zeertzjq) closes: #14825 Signed-off-by: zeertzjq <zeertzjq@outlook.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/ops.c')
-rw-r--r--src/ops.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ops.c b/src/ops.c
index 605a66494a..1dd36ab286 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2444,13 +2444,13 @@ charwise_block_prep(
int inclusive)
{
colnr_T startcol = 0, endcol = MAXCOL;
- int is_oneChar = FALSE;
colnr_T cs, ce;
char_u *p;
p = ml_get(lnum);
bdp->startspaces = 0;
bdp->endspaces = 0;
+ bdp->is_oneChar = FALSE;
bdp->start_char_vcols = 0;
if (lnum == start.lnum)
@@ -2487,7 +2487,7 @@ charwise_block_prep(
if (start.lnum == end.lnum && start.col == end.col)
{
// Special case: inside a single char
- is_oneChar = TRUE;
+ bdp->is_oneChar = TRUE;
bdp->startspaces = end.coladd - start.coladd + inclusive;
endcol = startcol;
}
@@ -2501,7 +2501,7 @@ charwise_block_prep(
}
if (endcol == MAXCOL)
endcol = ml_get_len(lnum);
- if (startcol > endcol || is_oneChar)
+ if (startcol > endcol || bdp->is_oneChar)
bdp->textlen = 0;
else
bdp->textlen = endcol - startcol + inclusive;