aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c59
1 files changed, 43 insertions, 16 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 3b5836f0b5..1cc270023c 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -2184,6 +2184,10 @@ win_line (
int prev_c1 = 0; /* first composing char for prev_c */
int did_line_attr = 0;
+ bool has_bufhl = false; // this buffer has highlight matches
+ int bufhl_attr = 0; // attributes desired by bufhl
+ bufhl_lineinfo_T bufhl_info; // bufhl data for this line
+
/* draw_state: items that are drawn in sequence: */
#define WL_START 0 /* nothing done yet */
# define WL_CMDLINE WL_START + 1 /* cmdline window column */
@@ -2244,6 +2248,11 @@ win_line (
}
}
+ if (bufhl_start_line(wp->w_buffer, lnum, &bufhl_info)) {
+ has_bufhl = true;
+ extra_check = true;
+ }
+
/* Check for columns to display for 'colorcolumn'. */
color_cols = wp->w_buffer->terminal ? NULL : wp->w_p_cc_cols;
if (color_cols != NULL)
@@ -3335,6 +3344,17 @@ win_line (
char_attr = hl_combine_attr(spell_attr, char_attr);
}
+ if (has_bufhl && v > 0) {
+ bufhl_attr = bufhl_get_attr(&bufhl_info, (colnr_T)v);
+ if (bufhl_attr != 0) {
+ if (!attr_pri) {
+ char_attr = hl_combine_attr(char_attr, bufhl_attr);
+ } else {
+ char_attr = hl_combine_attr(bufhl_attr, char_attr);
+ }
+ }
+ }
+
if (wp->w_buffer->terminal) {
char_attr = hl_combine_attr(char_attr, term_attrs[vcol]);
}
@@ -6760,8 +6780,8 @@ int showmode(void)
if (Recording
&& edit_submode == NULL /* otherwise it gets too long */
) {
- MSG_PUTS_ATTR(_("recording"), attr);
- need_clear = TRUE;
+ recording_mode(attr);
+ need_clear = true;
}
mode_displayed = TRUE;
@@ -6800,26 +6820,33 @@ static void msg_pos_mode(void)
msg_row = Rows - 1;
}
-/*
- * Delete mode message. Used when ESC is typed which is expected to end
- * Insert mode (but Insert mode didn't end yet!).
- * Caller should check "mode_displayed".
- */
-void unshowmode(int force)
+/// Delete mode message. Used when ESC is typed which is expected to end
+/// Insert mode (but Insert mode didn't end yet!).
+/// Caller should check "mode_displayed".
+void unshowmode(bool force)
{
- /*
- * Don't delete it right now, when not redrawing or inside a mapping.
- */
- if (!redrawing() || (!force && char_avail() && !KeyTyped))
- redraw_cmdline = TRUE; /* delete mode later */
- else {
+ // Don't delete it right now, when not redrawing or inside a mapping.
+ if (!redrawing() || (!force && char_avail() && !KeyTyped)) {
+ redraw_cmdline = true; // delete mode later
+ } else {
msg_pos_mode();
- if (Recording)
- MSG_PUTS_ATTR(_("recording"), hl_attr(HLF_CM));
+ if (Recording) {
+ recording_mode(hl_attr(HLF_CM));
+ }
msg_clr_eos();
}
}
+static void recording_mode(int attr)
+{
+ MSG_PUTS_ATTR(_("recording"), attr);
+ if (!shortmess(SHM_RECORDING)) {
+ char_u s[4];
+ vim_snprintf((char *)s, ARRAY_SIZE(s), " @%c", Recording);
+ MSG_PUTS_ATTR(s, attr);
+ }
+}
+
/*
* Draw the tab pages line at the top of the Vim window.
*/