mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.4660: cursorcolumn is sometimes not correct
Problem: Cursorcolumn is sometimes not correct. Solution: Recompute the cursor column when entering Insert mode and the cursor is on a character wider than a screen cell.
This commit is contained in:
13
src/edit.c
13
src/edit.c
@@ -293,11 +293,14 @@ edit(
|
|||||||
conceal_check_cursor_line(cursor_line_was_concealed);
|
conceal_check_cursor_line(cursor_line_was_concealed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
// Need to recompute the cursor position, it might move when the cursor
|
||||||
* Need to recompute the cursor position, it might move when the cursor is
|
// is on a TAB or special character.
|
||||||
* on a TAB or special character.
|
// ptr2cells() treats a TAB character as double-width.
|
||||||
*/
|
if (ptr2cells(ml_get_cursor()) > 1)
|
||||||
curs_columns(TRUE);
|
{
|
||||||
|
curwin->w_valid &= ~VALID_VIRTCOL;
|
||||||
|
curs_columns(TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable langmap or IME, indicated by 'iminsert'.
|
* Enable langmap or IME, indicated by 'iminsert'.
|
||||||
|
8
src/testdir/dumps/Test_cursorcolumn_insert_on_tab_1.dump
Normal file
8
src/testdir/dumps/Test_cursorcolumn_insert_on_tab_1.dump
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|1+0&#ffffff0|2|3|4|5|6|7|8+0&#e0e0e08|9+0&#ffffff0| @65
|
||||||
|
|a| @5> |b| @65
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
| +0#0000000&@56|2|,|2|-|8| @8|A|l@1|
|
8
src/testdir/dumps/Test_cursorcolumn_insert_on_tab_2.dump
Normal file
8
src/testdir/dumps/Test_cursorcolumn_insert_on_tab_2.dump
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
|1+0&#ffffff0|2+0&#e0e0e08|3+0&#ffffff0|4|5|6|7|8|9| @65
|
||||||
|
|a> @6|b| @65
|
||||||
|
|~+0#4040ff13&| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|~| @73
|
||||||
|
|-+2#0000000&@1| |I|N|S|E|R|T| |-@1| +0&&@44|2|,|2| @10|A|l@1|
|
@@ -592,6 +592,28 @@ func Test_cursorline_with_visualmode()
|
|||||||
call delete('Xtest_cursorline_with_visualmode')
|
call delete('Xtest_cursorline_with_visualmode')
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
func Test_cursorcolumn_insert_on_tab()
|
||||||
|
CheckScreendump
|
||||||
|
|
||||||
|
let lines =<< trim END
|
||||||
|
call setline(1, ['123456789', "a\tb"])
|
||||||
|
set cursorcolumn
|
||||||
|
call cursor(2, 2)
|
||||||
|
END
|
||||||
|
call writefile(lines, 'Xcuc_insert_on_tab')
|
||||||
|
|
||||||
|
let buf = RunVimInTerminal('-S Xcuc_insert_on_tab', #{rows: 8})
|
||||||
|
call TermWait(buf)
|
||||||
|
call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_1', {})
|
||||||
|
|
||||||
|
call term_sendkeys(buf, 'i')
|
||||||
|
call TermWait(buf)
|
||||||
|
call VerifyScreenDump(buf, 'Test_cursorcolumn_insert_on_tab_2', {})
|
||||||
|
|
||||||
|
call StopVimInTerminal(buf)
|
||||||
|
call delete('Xcuc_insert_on_tab')
|
||||||
|
endfunc
|
||||||
|
|
||||||
func Test_cursorcolumn_callback()
|
func Test_cursorcolumn_callback()
|
||||||
CheckScreendump
|
CheckScreendump
|
||||||
CheckFeature timers
|
CheckFeature timers
|
||||||
|
@@ -750,6 +750,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 */
|
||||||
|
/**/
|
||||||
|
4660,
|
||||||
/**/
|
/**/
|
||||||
4659,
|
4659,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user