Skip to content

Commit

Permalink
yet more
Browse files Browse the repository at this point in the history
  • Loading branch information
bfredl committed May 8, 2017
1 parent 9aae034 commit e7d8a73
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 32 deletions.
5 changes: 5 additions & 0 deletions src/nvim/buffer_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1169,4 +1169,9 @@ struct window_S {
qf_info_T *w_llist_ref;
};

static inline int win_hl_attr(win_T *wp, int hlf)
{
return wp->w_hl_attrs[hlf];
}

#endif // NVIM_BUFFER_DEFS_H
8 changes: 4 additions & 4 deletions src/nvim/popupmnu.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,10 @@ void pum_redraw(void)
{
int row = pum_row;
int col;
int attr_norm = highlight_attr[HLF_PNI];
int attr_select = highlight_attr[HLF_PSI];
int attr_scroll = highlight_attr[HLF_PSB];
int attr_thumb = highlight_attr[HLF_PST];
int attr_norm = win_hl_attr(curwin, HLF_PNI);
int attr_select = win_hl_attr(curwin, HLF_PSI);
int attr_scroll = win_hl_attr(curwin, HLF_PSB);
int attr_thumb = win_hl_attr(curwin, HLF_PST);
int attr;
int i;
int idx;
Expand Down
53 changes: 26 additions & 27 deletions src/nvim/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1488,19 +1488,19 @@ static void win_update(win_T *wp)

// Last line isn't finished: Display "@@@" in the last screen line.
screen_puts_len((char_u *)"@@", 2, scr_row, wp->w_wincol,
hl_attr(HLF_AT));
win_hl_attr(wp, HLF_AT));

screen_fill(scr_row, scr_row + 1,
(int)wp->w_wincol + 2, (int)W_ENDCOL(wp),
'@', ' ', hl_attr(HLF_AT));
'@', ' ', win_hl_attr(wp, HLF_AT));
set_empty_rows(wp, srow);
wp->w_botline = lnum;
} else if (dy_flags & DY_LASTLINE) { // 'display' has "lastline"
// Last line isn't finished: Display "@@@" at the end.
screen_fill(wp->w_winrow + wp->w_height - 1,
wp->w_winrow + wp->w_height,
W_ENDCOL(wp) - 3, W_ENDCOL(wp),
'@', '@', hl_attr(HLF_AT));
'@', '@', win_hl_attr(wp, HLF_AT));
set_empty_rows(wp, srow);
wp->w_botline = lnum;
} else {
Expand Down Expand Up @@ -1596,7 +1596,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
n = wp->w_width;
screen_fill(wp->w_winrow + row, wp->w_winrow + endrow,
W_ENDCOL(wp) - n, W_ENDCOL(wp),
' ', ' ', hl_attr(HLF_FC));
' ', ' ', win_hl_attr(wp, HLF_FC));
}

if (signcolumn_on(wp)) {
Expand All @@ -1608,7 +1608,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
}
screen_fill(wp->w_winrow + row, wp->w_winrow + endrow,
W_ENDCOL(wp) - nn, W_ENDCOL(wp) - n,
' ', ' ', hl_attr(HLF_SC));
' ', ' ', win_hl_attr(wp, HLF_SC));
n = nn;
}

Expand All @@ -1626,7 +1626,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
n = wp->w_width;
screen_fill(wp->w_winrow + row, wp->w_winrow + endrow,
wp->w_wincol, wp->w_wincol + n,
cmdwin_type, ' ', hl_attr(HLF_AT));
cmdwin_type, ' ', win_hl_attr(wp, HLF_AT));
}
if (fdc > 0) {
int nn = n + fdc;
Expand All @@ -1636,7 +1636,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
nn = wp->w_width;
screen_fill(wp->w_winrow + row, wp->w_winrow + endrow,
wp->w_wincol + n, wp->w_wincol + nn,
' ', ' ', hl_attr(HLF_FC));
' ', ' ', win_hl_attr(wp, HLF_FC));
n = nn;
}

Expand All @@ -1649,7 +1649,7 @@ static void win_draw_end(win_T *wp, int c1, int c2, int row, int endrow, hlf_T h
}
screen_fill(wp->w_winrow + row, wp->w_winrow + endrow,
wp->w_wincol + n, wp->w_wincol + nn,
' ', ' ', hl_attr(HLF_SC));
' ', ' ', win_hl_attr(wp, HLF_SC));
n = nn;
}

Expand Down Expand Up @@ -5558,10 +5558,6 @@ static void init_window_hl(win_T *wp)

}

static int win_hl_attr(win_T *wp, int hlf) {
return wp->w_hl_attrs[hlf];
}

/*
* Advance to the match in window "wp" line "lnum" or past it.
*/
Expand Down Expand Up @@ -6749,7 +6745,7 @@ int showmode(void)

/* Position on the last line in the window, column 0 */
msg_pos_mode();
attr = hl_attr(HLF_CM); /* Highlight mode */
attr = win_hl_attr(curwin, HLF_CM); /* Highlight mode */
if (do_mode) {
MSG_PUTS_ATTR("--", attr);
// CTRL-X in Insert mode
Expand All @@ -6771,7 +6767,7 @@ int showmode(void)
if (edit_submode_extra != NULL) {
MSG_PUTS_ATTR(" ", attr); // Add a space in between.
if ((int)edit_submode_highl < (int)HLF_COUNT) {
sub_attr = hl_attr(edit_submode_highl);
sub_attr = win_hl_attr(curwin, edit_submode_highl);
} else {
sub_attr = attr;
}
Expand Down Expand Up @@ -6893,7 +6889,7 @@ void clearmode(void)
{
msg_pos_mode();
if (Recording) {
recording_mode(hl_attr(HLF_CM));
recording_mode(win_hl_attr(curwin, HLF_CM));
}
msg_clr_eos();
}
Expand Down Expand Up @@ -6924,7 +6920,6 @@ static void draw_tabline(void)
int modified;
int c;
int len;
int attr_sel = hl_attr(HLF_TPS);
int attr_nosel = hl_attr(HLF_TP);
int attr_fill = hl_attr(HLF_TPF);
char_u *p;
Expand Down Expand Up @@ -6986,16 +6981,6 @@ static void draw_tabline(void)

scol = col;

if (tp->tp_topframe == topframe)
attr = attr_sel;
if (use_sep_chars && col > 0)
screen_putchar('|', 0, col++, attr);

if (tp->tp_topframe != topframe)
attr = attr_nosel;

screen_putchar(' ', 0, col++, attr);

if (tp == curtab) {
cwp = curwin;
wp = firstwin;
Expand All @@ -7004,18 +6989,32 @@ static void draw_tabline(void)
wp = tp->tp_firstwin;
}


if (tp->tp_topframe == topframe)
attr = win_hl_attr(cwp, HLF_TPS);
if (use_sep_chars && col > 0)
screen_putchar('|', 0, col++, attr);

if (tp->tp_topframe != topframe)
attr = win_hl_attr(cwp, HLF_TP);

screen_putchar(' ', 0, col++, attr);

modified = FALSE;

for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount)
if (bufIsChanged(wp->w_buffer))
modified = TRUE;


if (modified || wincount > 1) {
if (wincount > 1) {
vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
len = (int)STRLEN(NameBuff);
if (col + len >= Columns - 3)
break;
screen_puts_len(NameBuff, len, 0, col,
hl_combine_attr(attr, win_hl_attr(wp, HLF_T)));
hl_combine_attr(attr, win_hl_attr(cwp, HLF_T)));
col += len;
}
if (modified)
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ void terminal_get_line_attributes(Terminal *term, win_T *wp, int linenr,
if (term->cursor.visible && term->cursor.row == row
&& term->cursor.col == col) {
attr_id = hl_combine_attr(attr_id, is_focused(term) && wp == curwin ?
hl_attr(HLF_TERM) : hl_attr(HLF_TERMNC));
win_hl_attr(wp, HLF_TERM) : win_hl_attr(wp, HLF_TERMNC));
}

term_attrs[col] = attr_id;
Expand Down

0 comments on commit e7d8a73

Please sign in to comment.