forked from aniani/vim
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>
This commit is contained in:
committed by
Christian Brabandt
parent
d3c0ff5d5a
commit
b2d124c625
@@ -798,6 +798,45 @@ linetabsize(win_T *wp, linenr_T lnum)
|
||||
ml_get_buf(wp->w_buffer, lnum, FALSE), (colnr_T)MAXCOL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Like linetabsize(), but excludes 'above'/'after'/'right'/'below' aligned
|
||||
* virtual text, while keeping inline virtual text.
|
||||
*/
|
||||
int
|
||||
linetabsize_no_outer(win_T *wp, linenr_T lnum)
|
||||
{
|
||||
#ifndef FEAT_PROP_POPUP
|
||||
return linetabsize(wp, lnum);
|
||||
#else
|
||||
chartabsize_T cts;
|
||||
char_u *line = ml_get_buf(wp->w_buffer, lnum, FALSE);
|
||||
|
||||
init_chartabsize_arg(&cts, wp, lnum, 0, line, line);
|
||||
|
||||
if (cts.cts_text_prop_count)
|
||||
{
|
||||
int write_idx = 0;
|
||||
for (int read_idx = 0; read_idx < cts.cts_text_prop_count; read_idx++)
|
||||
{
|
||||
textprop_T *tp = &cts.cts_text_props[read_idx];
|
||||
if (tp->tp_col != MAXCOL)
|
||||
{
|
||||
if (read_idx != write_idx)
|
||||
cts.cts_text_props[write_idx] = *tp;
|
||||
write_idx++;
|
||||
}
|
||||
}
|
||||
cts.cts_text_prop_count = write_idx;
|
||||
if (cts.cts_text_prop_count == 0)
|
||||
VIM_CLEAR(cts.cts_text_props);
|
||||
}
|
||||
|
||||
win_linetabsize_cts(&cts, (colnr_T)MAXCOL);
|
||||
clear_chartabsize_arg(&cts);
|
||||
return (int)cts.cts_vcol;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
win_linetabsize_cts(chartabsize_T *cts, colnr_T len)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user