0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1792: problem with gj/gk/gM and virtual text

Problem:  Normal mode "gM", "gj", "gk" commands behave incorrectly with
          virtual text.
Solution: Use linetabsize() instead of linetabsize_str().

closes: #12909

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
zeertzjq
2023-08-27 11:17:39 +02:00
committed by Christian Brabandt
parent 58f39d89a8
commit d809c0a903
12 changed files with 106 additions and 6 deletions

View File

@@ -2304,7 +2304,7 @@ find_decl(
static int
nv_screengo(oparg_T *oap, int dir, long dist)
{
int linelen = linetabsize_str(ml_get_curline());
int linelen = linetabsize(curwin, curwin->w_cursor.lnum);
int retval = OK;
int atend = FALSE;
int n;
@@ -2374,7 +2374,7 @@ nv_screengo(oparg_T *oap, int dir, long dist)
}
cursor_up_inner(curwin, 1);
linelen = linetabsize_str(ml_get_curline());
linelen = linetabsize(curwin, curwin->w_cursor.lnum);
if (linelen > width1)
curwin->w_curswant += (((linelen - width1 - 1) / width2)
+ 1) * width2;
@@ -2411,7 +2411,7 @@ nv_screengo(oparg_T *oap, int dir, long dist)
// clipped to column 0.
if (curwin->w_curswant >= width1)
curwin->w_curswant -= width2;
linelen = linetabsize_str(ml_get_curline());
linelen = linetabsize(curwin, curwin->w_cursor.lnum);
}
}
}
@@ -6052,7 +6052,7 @@ nv_g_cmd(cmdarg_T *cap)
{
oap->motion_type = MCHAR;
oap->inclusive = FALSE;
i = linetabsize_str(ml_get_curline());
i = linetabsize(curwin, curwin->w_cursor.lnum);
if (cap->count0 > 0 && cap->count0 <= 100)
coladvance((colnr_T)(i * cap->count0 / 100));
else