Skip to content

Commit a381773

Browse files
committed
patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Problem: In a terminal window 'cursorlineopt' does not work properly. Solution: Check the 'cursorlineopt' value. (closes #5055)
1 parent 1142a31 commit a381773

6 files changed

Lines changed: 55 additions & 8 deletions

File tree

src/drawline.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,14 +1401,7 @@ win_line(
14011401
{
14021402
#ifdef FEAT_TERMINAL
14031403
if (get_term_attr)
1404-
{
14051404
syntax_attr = term_get_attr(wp->w_buffer, lnum, vcol);
1406-
1407-
if (!attr_pri)
1408-
char_attr = syntax_attr;
1409-
else
1410-
char_attr = hl_combine_attr(syntax_attr, char_attr);
1411-
}
14121405
#endif
14131406

14141407
#ifdef FEAT_SYN_HL
@@ -2295,7 +2288,8 @@ win_line(
22952288
if (win_attr != 0)
22962289
{
22972290
char_attr = win_attr;
2298-
if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
2291+
if (wp->w_p_cul && lnum == wp->w_cursor.lnum
2292+
&& wp->w_p_culopt_flags != CULOPT_NBR)
22992293
{
23002294
if (!cul_screenline || (vcol >= left_curline_col
23012295
&& vcol <= right_curline_col))
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0#af5f00255#ffffff0@1|1| |1+0#0000000&@4| @65
2+
| +0#af5f00255&@1|2| |1+0#0000000&@3|2| @65
3+
| +8#af5f00255&@1|3| >1+8#0000000&@3|3| @65
4+
| +0#af5f00255&@1|4| |1+0#0000000&@3|4| @65
5+
| +0#af5f00255&@1|5| |1+0#0000000&@3|5| @65
6+
| +0#af5f00255&@1|6| |1+0#0000000&@3|6| @65
7+
| +0#af5f00255&@1|7| |1+0#0000000&@3|7| @65
8+
|:|s|e|t| |n|u|m|b|e|r| |c|u|r|s|o|r|l|i|n|e| |c|u|l|o|p|t|=|b|o|t|h| @22|3|,|1| @10|T|o|p|
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0#af5f00255#ffffff0@1|1| |1+0#0000000&@4| @65
2+
| +0#af5f00255&@1|2| |1+0#0000000&@3|2| @65
3+
| +8#af5f00255&@1|3| >1+0#0000000&@3|3| @65
4+
| +0#af5f00255&@1|4| |1+0#0000000&@3|4| @65
5+
| +0#af5f00255&@1|5| |1+0#0000000&@3|5| @65
6+
| +0#af5f00255&@1|6| |1+0#0000000&@3|6| @65
7+
| +0#af5f00255&@1|7| |1+0#0000000&@3|7| @65
8+
|:|s|e|t| |c|u|l|o|p|t|=|n|u|m|b|e|r| @38|3|,|1| @10|T|o|p|
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
| +0#af5f00255#ffffff0@1|1| |1+0#0000000&@4| @65
2+
| +0#af5f00255&@1|2| |1+0#0000000&@3|2| @65
3+
| +0#af5f00255&@1|3| >1+8#0000000&@3|3| @65
4+
| +0#af5f00255&@1|4| |1+0#0000000&@3|4| @65
5+
| +0#af5f00255&@1|5| |1+0#0000000&@3|5| @65
6+
| +0#af5f00255&@1|6| |1+0#0000000&@3|6| @65
7+
| +0#af5f00255&@1|7| |1+0#0000000&@3|7| @65
8+
|:|s|e|t| |c|u|l|o|p|t|=|l|i|n|e| @40|3|,|1| @10|T|o|p|

src/testdir/test_terminal.vim

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,6 +1906,33 @@ func Test_terminal_switch_mode()
19061906
bwipe!
19071907
endfunc
19081908

1909+
func Test_terminal_normal_mode()
1910+
CheckRunVimInTerminal
1911+
1912+
" Run Vim in a terminal and open a terminal window to run Vim in.
1913+
let lines =<< trim END
1914+
call setline(1, range(11111, 11122))
1915+
3
1916+
END
1917+
call writefile(lines, 'XtermNormal')
1918+
let buf = RunVimInTerminal('-S XtermNormal', {'rows': 8})
1919+
call term_wait(buf)
1920+
1921+
call term_sendkeys(buf, "\<C-W>N")
1922+
call term_sendkeys(buf, ":set number cursorline culopt=both\r")
1923+
call VerifyScreenDump(buf, 'Test_terminal_normal_1', {})
1924+
1925+
call term_sendkeys(buf, ":set culopt=number\r")
1926+
call VerifyScreenDump(buf, 'Test_terminal_normal_2', {})
1927+
1928+
call term_sendkeys(buf, ":set culopt=line\r")
1929+
call VerifyScreenDump(buf, 'Test_terminal_normal_3', {})
1930+
1931+
call term_sendkeys(buf, "a:q!\<CR>:q\<CR>:q\<CR>")
1932+
call StopVimInTerminal(buf)
1933+
call delete('XtermNormal')
1934+
endfunc
1935+
19091936
func Test_terminal_hidden_and_close()
19101937
CheckUnix
19111938

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -753,6 +753,8 @@ static char *(features[]) =
753753

754754
static int included_patches[] =
755755
{ /* Add new patch number below this line */
756+
/**/
757+
2155,
756758
/**/
757759
2154,
758760
/**/

0 commit comments

Comments
 (0)