Last active
March 25, 2016 08:17
-
-
Save mattn/24ec762c490e66d5f70a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/screen.c b/src/screen.c | |
index 9d854a2..d12068e 100644 | |
--- a/src/screen.c | |
+++ b/src/screen.c | |
@@ -2984,6 +2984,9 @@ win_line( | |
int change_start = MAXCOL; /* first col of changed area */ | |
int change_end = -1; /* last col of changed area */ | |
#endif | |
+#ifdef LINE_ATTR | |
+ int linehl_attr = (hlf_T)0; /* type of linehl highlighting */ | |
+#endif | |
colnr_T trailcol = MAXCOL; /* start of trailing spaces */ | |
#ifdef FEAT_LINEBREAK | |
int need_showbreak = FALSE; | |
@@ -3575,6 +3578,14 @@ win_line( | |
area_highlighting = TRUE; | |
} | |
#endif | |
+#ifdef LINE_ATTR | |
+ if (get_syntax_info(&syntax_seqnr) & HL_LINEHL) | |
+ { | |
+ linehl_attr = get_syntax_attr(1, NULL, FALSE); | |
+ line_attr = linehl_attr; | |
+ area_highlighting = TRUE; | |
+ } | |
+#endif | |
off = (unsigned)(current_ScreenLine - ScreenLines); | |
col = 0; | |
@@ -3785,6 +3796,8 @@ win_line( | |
# endif | |
} | |
# endif | |
+ if (linehl_attr != 0) | |
+ line_attr = hl_combine_attr(line_attr, linehl_attr); | |
p_extra = NULL; | |
c_extra = ' '; | |
n_extra = get_breakindent_win(wp, | |
@@ -3832,6 +3845,8 @@ win_line( | |
* required when 'linebreak' is also set. */ | |
if (tocol == vcol) | |
tocol += n_extra; | |
+ if (linehl_attr != 0) | |
+ line_attr = hl_combine_attr(line_attr, linehl_attr); | |
#ifdef FEAT_SYN_HL | |
/* combine 'showbreak' with 'cursorline' */ | |
if (wp->w_p_cul && lnum == wp->w_cursor.lnum) | |
@@ -4023,6 +4038,8 @@ win_line( | |
} | |
#endif | |
+ if (linehl_attr != 0) | |
+ line_attr = hl_combine_attr(line_attr, linehl_attr); | |
#ifdef FEAT_DIFF | |
if (diff_hlf != (hlf_T)0) | |
{ | |
diff --git a/src/syntax.c b/src/syntax.c | |
index 29b6888..d16b7f9 100644 | |
--- a/src/syntax.c | |
+++ b/src/syntax.c | |
@@ -955,6 +955,8 @@ syn_sync( | |
cur_si = &CUR_STATE(current_state.ga_len - 1); | |
cur_si->si_h_startpos.lnum = found_current_lnum; | |
cur_si->si_h_startpos.col = found_current_col; | |
+ /* TODO */ | |
+ cur_si->si_h_startpos.col = 0; | |
update_si_end(cur_si, (int)current_col, TRUE); | |
check_keepend(); | |
} | |
@@ -2232,6 +2234,13 @@ syn_current_attr( | |
if (hl_startpos.lnum == current_lnum | |
&& (int)hl_startpos.col < startcol) | |
hl_startpos.col = startcol; | |
+ | |
+ if (spp->sp_flags & HL_LINEHL) | |
+ { | |
+ hl_startpos.col = startcol = 0; | |
+ hl_endpos.col = endpos.col = MAXCOL-1; | |
+ } | |
+ | |
limit_pos_zero(&hl_endpos, &endpos); | |
next_match_idx = idx; | |
@@ -4022,6 +4031,7 @@ syn_list_one( | |
{HL_EXCLUDENL, "excludenl"}, | |
{HL_TRANSP, "transparent"}, | |
{HL_FOLD, "fold"}, | |
+ {HL_LINEHL, "linehl"}, | |
#ifdef FEAT_CONCEAL | |
{HL_CONCEAL, "conceal"}, | |
{HL_CONCEALENDS, "concealends"}, | |
@@ -4565,12 +4575,13 @@ get_syn_options( | |
{"fFoOlLdD", 0, HL_FOLD}, | |
{"cCoOnNcCeEaAlL", 0, HL_CONCEAL}, | |
{"cCoOnNcCeEaAlLeEnNdDsS", 0, HL_CONCEALENDS}, | |
+ {"lLiInNeEhHlL", 0, HL_LINEHL}, | |
{"cCcChHaArR", 11, 0}, | |
{"cCoOnNtTaAiInNsS", 1, 0}, | |
{"cCoOnNtTaAiInNeEdDiInN", 2, 0}, | |
{"nNeExXtTgGrRoOuUpP", 3, 0}, | |
}; | |
- static char *first_letters = "cCoOkKeEtTsSgGdDfFnN"; | |
+ static char *first_letters = "cCoOkKeEtTsSgGdDfFnNlL"; | |
if (arg == NULL) /* already detected error */ | |
return NULL; | |
@@ -4604,8 +4615,10 @@ get_syn_options( | |
if (opt->keyword | |
&& (flagtab[fidx].flags == HL_DISPLAY | |
|| flagtab[fidx].flags == HL_FOLD | |
- || flagtab[fidx].flags == HL_EXTEND)) | |
- /* treat "display", "fold" and "extend" as a keyword */ | |
+ || flagtab[fidx].flags == HL_EXTEND | |
+ || flagtab[fidx].flags == HL_LINEHL)) | |
+ /* treat "display", "fold" and "extend" and "linehl" as a | |
+ * keyword */ | |
fidx = -1; | |
break; | |
} | |
diff --git a/src/vim.h b/src/vim.h | |
index a7443e9..149d157 100644 | |
--- a/src/vim.h | |
+++ b/src/vim.h | |
@@ -872,6 +872,7 @@ extern char *(*dyn_libintl_textdomain)(const char *domainname); | |
# define HL_TRANS_CONT 0x10000 /* transparent item without contains arg */ | |
# define HL_CONCEAL 0x20000 /* can be concealed */ | |
# define HL_CONCEALENDS 0x40000 /* can be concealed */ | |
+# define HL_LINEHL 0x80000 /* highlight whole line */ | |
#endif | |
/* Values for 'options' argument in do_search() and searchit() */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment