mirror of
https://github.com/vim/vim.git
synced 2025-08-26 20:03:41 -04:00
patch 9.0.1705: cursor position wrong when clicking on an unprintable char
Problem: cursor position wrong when clicking on an unprintable char Solution: Don't update prev_ptr when wlv.n_extra is not zero. closes: #12664 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
parent
0c6181fec4
commit
b25dbb3f9b
@ -1829,10 +1829,10 @@ win_line(
|
|||||||
|
|
||||||
win_line_start(wp, &wlv, FALSE);
|
win_line_start(wp, &wlv, FALSE);
|
||||||
|
|
||||||
|
char_u *prev_ptr = ptr;
|
||||||
// Repeat for the whole displayed line.
|
// Repeat for the whole displayed line.
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
char_u *prev_ptr = ptr;
|
|
||||||
#if defined(FEAT_CONCEAL) || defined(FEAT_SEARCH_EXTRA)
|
#if defined(FEAT_CONCEAL) || defined(FEAT_SEARCH_EXTRA)
|
||||||
int has_match_conc = 0; // match wants to conceal
|
int has_match_conc = 0; // match wants to conceal
|
||||||
#endif
|
#endif
|
||||||
@ -2261,9 +2261,9 @@ win_line(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_SEARCH_EXTRA
|
|
||||||
if (wlv.n_extra == 0)
|
if (wlv.n_extra == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef FEAT_SEARCH_EXTRA
|
||||||
// Check for start/end of 'hlsearch' and other matches.
|
// Check for start/end of 'hlsearch' and other matches.
|
||||||
// After end, check for start/end of next match.
|
// After end, check for start/end of next match.
|
||||||
// When another match, have to check for start again.
|
// When another match, have to check for start again.
|
||||||
@ -2273,15 +2273,16 @@ win_line(
|
|||||||
&match_conc, did_line_attr, lcs_eol_one,
|
&match_conc, did_line_attr, lcs_eol_one,
|
||||||
&on_last_col);
|
&on_last_col);
|
||||||
ptr = line + v; // "line" may have been changed
|
ptr = line + v; // "line" may have been changed
|
||||||
prev_ptr = ptr;
|
|
||||||
|
|
||||||
// Do not allow a conceal over EOL otherwise EOL will be missed
|
// Do not allow a conceal over EOL otherwise EOL will be missed
|
||||||
// and bad things happen.
|
// and bad things happen.
|
||||||
if (*ptr == NUL)
|
if (*ptr == NUL)
|
||||||
has_match_conc = 0;
|
has_match_conc = 0;
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
prev_ptr = ptr;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FEAT_DIFF
|
#ifdef FEAT_DIFF
|
||||||
if (wlv.diff_hlf != (hlf_T)0)
|
if (wlv.diff_hlf != (hlf_T)0)
|
||||||
{
|
{
|
||||||
|
@ -4036,4 +4036,47 @@ func Test_normal_r_ctrl_v_cmd()
|
|||||||
bw!
|
bw!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Test clicking on a TAB or an unprintable character in Normal mode
|
||||||
|
func Test_normal_click_on_ctrl_char()
|
||||||
|
let save_mouse = &mouse
|
||||||
|
set mouse=a
|
||||||
|
new
|
||||||
|
|
||||||
|
call setline(1, "a\<Tab>b\<C-K>c")
|
||||||
|
redraw
|
||||||
|
call test_setmouse(1, 1)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 1, 0, 1], getcurpos())
|
||||||
|
call test_setmouse(1, 2)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 2, 0, 8], getcurpos())
|
||||||
|
call test_setmouse(1, 3)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 2, 0, 8], getcurpos())
|
||||||
|
call test_setmouse(1, 7)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 2, 0, 8], getcurpos())
|
||||||
|
call test_setmouse(1, 8)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 2, 0, 8], getcurpos())
|
||||||
|
call test_setmouse(1, 9)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 3, 0, 9], getcurpos())
|
||||||
|
call test_setmouse(1, 10)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 4, 0, 10], getcurpos())
|
||||||
|
call test_setmouse(1, 11)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 4, 0, 10], getcurpos())
|
||||||
|
call test_setmouse(1, 12)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 5, 0, 12], getcurpos())
|
||||||
|
call test_setmouse(1, 13)
|
||||||
|
call feedkeys("\<LeftMouse>", 'xt')
|
||||||
|
call assert_equal([0, 1, 5, 0, v:maxcol], getcurpos())
|
||||||
|
|
||||||
|
bwipe!
|
||||||
|
let &mouse = save_mouse
|
||||||
|
endfunc
|
||||||
|
|
||||||
" vim: shiftwidth=2 sts=2 expandtab
|
" vim: shiftwidth=2 sts=2 expandtab
|
||||||
|
@ -695,6 +695,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1705,
|
||||||
/**/
|
/**/
|
||||||
1704,
|
1704,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user