aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/statusline.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/statusline.c')
-rw-r--r--src/nvim/statusline.c48
1 files changed, 19 insertions, 29 deletions
diff --git a/src/nvim/statusline.c b/src/nvim/statusline.c
index 6e0dc2e8f7..6414b2bb74 100644
--- a/src/nvim/statusline.c
+++ b/src/nvim/statusline.c
@@ -260,23 +260,17 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
{
static bool entered = false;
int attr;
- int curattr;
int row;
int col = 0;
int maxwidth;
- int width;
int n;
- int len;
int fillchar;
char buf[MAXPATHL];
char *stl;
- char *p;
char *opt_name;
int opt_scope = 0;
stl_hlrec_t *hltab;
StlClickRecord *tabtab;
- win_T *ewp;
- int p_crb_save;
bool is_stl_global = global_stl_height() > 0;
ScreenGrid *grid = &default_grid;
@@ -369,22 +363,22 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
// Temporarily reset 'cursorbind', we don't want a side effect from moving
// the cursor away and back.
- ewp = wp == NULL ? curwin : wp;
- p_crb_save = ewp->w_p_crb;
+ win_T *ewp = wp == NULL ? curwin : wp;
+ int p_crb_save = ewp->w_p_crb;
ewp->w_p_crb = false;
// Make a copy, because the statusline may include a function call that
// might change the option value and free the memory.
stl = xstrdup(stl);
- width = build_stl_str_hl(ewp, buf, sizeof(buf), stl, opt_name, opt_scope,
- fillchar, maxwidth, &hltab, &tabtab, NULL);
+ int width = build_stl_str_hl(ewp, buf, sizeof(buf), stl, opt_name, opt_scope,
+ fillchar, maxwidth, &hltab, &tabtab, NULL);
xfree(stl);
ewp->w_p_crb = p_crb_save;
// Make all characters printable.
- p = transstr(buf, true);
- len = (int)xstrlcpy(buf, p, sizeof(buf));
+ char *p = transstr(buf, true);
+ int len = (int)xstrlcpy(buf, p, sizeof(buf));
len = (size_t)len < sizeof(buf) ? len : (int)sizeof(buf) - 1;
xfree(p);
@@ -398,7 +392,7 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
// Draw each snippet with the specified highlighting.
grid_puts_line_start(grid, row);
- curattr = attr;
+ int curattr = attr;
p = buf;
for (n = 0; hltab[n].start != NULL; n++) {
int textlen = (int)(hltab[n].start - p);
@@ -709,21 +703,9 @@ static void ui_ext_tabline_update(void)
/// Draw the tab pages line at the top of the Vim window.
void draw_tabline(void)
{
- int tabcount = 0;
- int tabwidth = 0;
- int col = 0;
- int scol = 0;
- int attr;
win_T *wp;
- win_T *cwp;
- int wincount;
- int modified;
- int c;
- int len;
int attr_nosel = HL_ATTR(HLF_TP);
int attr_fill = HL_ATTR(HLF_TPF);
- char *p;
- int room;
int use_sep_chars = (t_colors < 8);
if (default_grid.chars == NULL) {
@@ -748,6 +730,14 @@ void draw_tabline(void)
if (*p_tal != NUL) {
win_redr_custom(NULL, false, false);
} else {
+ int tabcount = 0;
+ int tabwidth = 0;
+ int col = 0;
+ win_T *cwp;
+ int wincount;
+ int c;
+ int len;
+ char *p;
FOR_ALL_TABS(tp) {
tabcount++;
}
@@ -760,7 +750,7 @@ void draw_tabline(void)
tabwidth = 6;
}
- attr = attr_nosel;
+ int attr = attr_nosel;
tabcount = 0;
FOR_ALL_TABS(tp) {
@@ -768,7 +758,7 @@ void draw_tabline(void)
break;
}
- scol = col;
+ int scol = col;
if (tp == curtab) {
cwp = curwin;
@@ -791,7 +781,7 @@ void draw_tabline(void)
grid_putchar(&default_grid, ' ', 0, col++, attr);
- modified = false;
+ int modified = false;
for (wincount = 0; wp != NULL; wp = wp->w_next, wincount++) {
if (bufIsChanged(wp->w_buffer)) {
@@ -816,7 +806,7 @@ void draw_tabline(void)
grid_putchar(&default_grid, ' ', 0, col++, attr);
}
- room = scol - col + tabwidth - 1;
+ int room = scol - col + tabwidth - 1;
if (room > 0) {
// Get buffer name in NameBuff[]
get_trans_bufname(cwp->w_buffer);