patch 9.1.0200: `gj`/`gk` not skipping over outer virtual text lines
Problem: `gj`/`gk` was updating the desired cursor virtual column to
the outer virtual text, even though the actual cursor position
was moved to not be on the virtual text, leading the need to
do an extra `gj`/`gk` to move past each virtual text line.
(rickhowe)
Solution: Exclude the outer virtual text when getting the line length
for moving the cursor with `gj`/`gk`, so that no extra
movement is needed to skip over virtual text lines.
(Dylan Thacker-Smith)
fixes: #12028
related: #14262
Signed-off-by: Dylan Thacker-Smith <dylan.ah.smith@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/normal.c b/src/normal.c
index 5ef3a92..531b6f9 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2306,7 +2306,9 @@
static int
nv_screengo(oparg_T *oap, int dir, long dist)
{
- int linelen = linetabsize(curwin, curwin->w_cursor.lnum);
+
+ int linelen = linetabsize_no_outer(curwin, curwin->w_cursor.lnum);
+
int retval = OK;
int atend = FALSE;
int n;
@@ -2376,7 +2378,7 @@
}
cursor_up_inner(curwin, 1);
- linelen = linetabsize(curwin, curwin->w_cursor.lnum);
+ linelen = linetabsize_no_outer(curwin, curwin->w_cursor.lnum);
if (linelen > width1)
curwin->w_curswant += (((linelen - width1 - 1) / width2)
+ 1) * width2;
@@ -2413,7 +2415,7 @@
// clipped to column 0.
if (curwin->w_curswant >= width1)
curwin->w_curswant -= width2;
- linelen = linetabsize(curwin, curwin->w_cursor.lnum);
+ linelen = linetabsize_no_outer(curwin, curwin->w_cursor.lnum);
}
}
}