Skip to content

Commit a74fda6

Browse files
committed
patch 8.1.2181: highlighting wrong when item follows tab
Problem: Highlighting wrong when item follows tab. Solution: Don't use syntax attribute when n_extra is non-zero. (Christian Brabandt, closes #5076)
1 parent 00e192b commit a74fda6

4 files changed

Lines changed: 36 additions & 34 deletions

File tree

src/drawline.c

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1399,14 +1399,14 @@ win_line(
13991399
}
14001400
#endif
14011401

1402-
if (extra_check)
1402+
#ifdef FEAT_SYN_HL
1403+
syntax_attr = 0;
1404+
if (extra_check && n_extra == 0)
14031405
{
1404-
#ifdef FEAT_TERMINAL
1406+
# ifdef FEAT_TERMINAL
14051407
if (get_term_attr)
14061408
syntax_attr = term_get_attr(wp->w_buffer, lnum, vcol);
1407-
#endif
1408-
1409-
#ifdef FEAT_SYN_HL
1409+
# endif
14101410
// Get syntax attribute.
14111411
if (has_syntax)
14121412
{
@@ -1463,8 +1463,8 @@ win_line(
14631463
syntax_flags = get_syntax_info(&syntax_seqnr);
14641464
# endif
14651465
}
1466-
#endif
14671466
}
1467+
#endif
14681468

14691469
// Decide which of the highlight attributes to use.
14701470
attr_pri = TRUE;
@@ -1502,7 +1502,7 @@ win_line(
15021502
// Use line_attr when not in the Visual or 'incsearch' area
15031503
// (area_attr may be 0 when "noinvcur" is set).
15041504
# ifdef FEAT_SYN_HL
1505-
if (has_syntax)
1505+
if (syntax_attr != 0)
15061506
char_attr = hl_combine_attr(syntax_attr, line_attr);
15071507
else
15081508
# endif
@@ -1531,15 +1531,10 @@ win_line(
15311531
else
15321532
#endif
15331533
#ifdef FEAT_SYN_HL
1534-
if (has_syntax
1535-
# ifdef FEAT_TERMINAL
1536-
|| get_term_attr
1537-
# endif
1538-
)
1539-
char_attr = syntax_attr;
1540-
else
1541-
#endif
1534+
char_attr = syntax_attr;
1535+
#else
15421536
char_attr = 0;
1537+
#endif
15431538
}
15441539
}
15451540
if (char_attr == 0)

src/feature.h

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,6 @@
429429
# define FEAT_CONCEAL
430430
#endif
431431

432-
/*
433-
* +textprop Text properties and popup windows
434-
*/
435-
#if defined(FEAT_EVAL) && defined(FEAT_SYN_HL)
436-
# define FEAT_TEXT_PROP
437-
#endif
438-
439-
#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME)
440-
// Can limit syntax highlight time to 'redrawtime'.
441-
# define SYN_TIME_LIMIT 1
442-
#endif
443-
444432
/*
445433
* +spell spell checking
446434
*
@@ -1119,10 +1107,6 @@
11191107
# define FEAT_ARP
11201108
#endif
11211109

1122-
/*
1123-
* +GUI_Athena To compile Vim with or without the GUI (gvim) you have
1124-
* +GUI_Motif to edit the Makefile.
1125-
*/
11261110

11271111
/*
11281112
* +ole Win32 OLE automation: Use Makefile.ovc.
@@ -1138,6 +1122,8 @@
11381122
* +tcl TCL interface: "--enable-tclinterp"
11391123
* +netbeans_intg Netbeans integration
11401124
* +channel Inter process communication
1125+
* +GUI_Athena Athena GUI
1126+
* +GUI_Motif Motif GUI
11411127
*/
11421128

11431129
/*
@@ -1170,6 +1156,23 @@
11701156
#if defined(FEAT_TERMINAL) && !defined(CURSOR_SHAPE)
11711157
# define CURSOR_SHAPE
11721158
#endif
1159+
#if defined(FEAT_TERMINAL) && !defined(FEAT_SYN_HL)
1160+
// simplify the code a bit by enabling +syntax when +terminal is enabled
1161+
# define FEAT_SYN_HL
1162+
#endif
1163+
1164+
/*
1165+
* +textprop Text properties and popup windows
1166+
*/
1167+
#if defined(FEAT_EVAL) && defined(FEAT_SYN_HL)
1168+
# define FEAT_TEXT_PROP
1169+
#endif
1170+
1171+
#if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME)
1172+
// Can limit syntax highlight time to 'redrawtime'.
1173+
# define SYN_TIME_LIMIT 1
1174+
#endif
1175+
11731176

11741177
/*
11751178
* +signs Allow signs to be displayed to the left of text lines.

src/testdir/dumps/Test_syntax_c_01.dump

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
|}| @73
1313
@3|s+0#00e0003&|t|a|t|i|c| +0#0000000&|v+0#00e0003&|o|i|d| +0#0000000&@60
1414
|m|y|F|u|n|c|t|i|o|n|(|c+0#00e0003&|o|n|s|t| +0#0000000&|d+0#00e0003&|o|u|b|l|e| +0#0000000&|c|o|u|n|t|,| |s+0#00e0003&|t|r|u|c|t| +0#0000000&|n|o|t|h|i|n|g|,| |l+0#00e0003&|o|n|g| +0#0000000&|t|h|e|r|e|)| |{| @14
15-
@1| +0#0000e05&@6|/@1| |1+0#e000002&|2|3|:+0#0000e05&| |n|o|t|h|i|n|g| |t|o| |e+0&#ffff4012|n|d|i|f| +0&#ffffff0|h|e|r|e| +0#0000000&@37
16-
@1| +0#af5f00255&@6|f|o|r| +0#0000000&|(|i+0#00e0003&|n|t| +0#0000000&|i| |=| |0+0#e000002&|;+0#0000000&| |i| |<| |c|o|u|n|t|;| |+@1|i|)| |{| @33
15+
@8|/+0#0000e05&@1| |1+0#e000002&|2|3|:+0#0000e05&| |n|o|t|h|i|n|g| |t|o| |e+0&#ffff4012|n|d|i|f| +0&#ffffff0|h|e|r|e| +0#0000000&@37
16+
@8|f+0#af5f00255&|o|r| +0#0000000&|(|i+0#00e0003&|n|t| +0#0000000&|i| |=| |0+0#e000002&|;+0#0000000&| |i| |<| |c|o|u|n|t|;| |+@1|i|)| |{| @33
1717
@11|b+0#af5f00255&|r|e|a|k|;+0#0000000&| @57
1818
@8|}| @65
19+
@8|N+0&#ffff4012|o|t|e|:+0&#ffffff0| |a|s|d|f| @56
1920
|}| @73
20-
|-+2&&@1| |V|I|S|U|A|L| |-@1| +0&&@34|2| @8|1|0|,|3|7| @8|A|l@1|
21+
|~+0#4040ff13&| @73
22+
|-+2#0000000&@1| |V|I|S|U|A|L| |-@1| +0&&@34|2| @8|1|0|,|3|7| @8|A|l@1|

src/version.c

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

742742
static int included_patches[] =
743743
{ /* Add new patch number below this line */
744+
/**/
745+
2181,
744746
/**/
745747
2180,
746748
/**/

0 commit comments

Comments
 (0)