From 362f3569aeb4806860e50ef5ea633168496e0524 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 3 Nov 2009 16:20:34 +0000 Subject: updated for version 7.2-280 --- src/screen.c | 54 ++++++++++++++++++++++++++++++++++++------------------ src/version.c | 2 ++ 2 files changed, 38 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/screen.c b/src/screen.c index 28fe238d26..7570b6f11c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -132,7 +132,7 @@ static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width static void draw_vsep_win __ARGS((win_T *wp, int row)); #endif #ifdef FEAT_STL_OPT -static void redraw_custum_statusline __ARGS((win_T *wp)); +static void redraw_custom_statusline __ARGS((win_T *wp)); #endif #ifdef FEAT_SEARCH_EXTRA #define SEARCH_HL_PRIORITY 0 @@ -5772,7 +5772,7 @@ win_redr_status(wp) else if (*p_stl != NUL || *wp->w_p_stl != NUL) { /* redraw custom status line */ - redraw_custum_statusline(wp); + redraw_custom_statusline(wp); } #endif else @@ -5897,18 +5897,31 @@ win_redr_status(wp) * errors encountered. */ static void -redraw_custum_statusline(wp) +redraw_custom_statusline(wp) win_T *wp; { - int save_called_emsg = called_emsg; + static int entered = FALSE; + int save_called_emsg = called_emsg; + + /* When called recursively return. This can happen when the statusline + * contains an expression that triggers a redraw. */ + if (entered) + return; + entered = TRUE; called_emsg = FALSE; win_redr_custom(wp, FALSE); if (called_emsg) + { + /* When there is an error disable the statusline, otherwise the + * display is messed up with errors and a redraw triggers the problem + * again and again. */ set_string_option_direct((char_u *)"statusline", -1, (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR); + } called_emsg |= save_called_emsg; + entered = FALSE; } #endif @@ -6016,6 +6029,7 @@ win_redr_custom(wp, draw_ruler) int len; int fillchar; char_u buf[MAXPATHL]; + char_u *stl; char_u *p; struct stl_hlrec hltab[STL_MAX_ITEM]; struct stl_hlrec tabtab[STL_MAX_ITEM]; @@ -6025,7 +6039,7 @@ win_redr_custom(wp, draw_ruler) if (wp == NULL) { /* Use 'tabline'. Always at the first line of the screen. */ - p = p_tal; + stl = p_tal; row = 0; fillchar = ' '; attr = hl_attr(HLF_TPF); @@ -6042,17 +6056,17 @@ win_redr_custom(wp, draw_ruler) if (draw_ruler) { - p = p_ruf; + stl = p_ruf; /* advance past any leading group spec - implicit in ru_col */ - if (*p == '%') + if (*stl == '%') { - if (*++p == '-') - p++; - if (atoi((char *) p)) - while (VIM_ISDIGIT(*p)) - p++; - if (*p++ != '(') - p = p_ruf; + if (*++stl == '-') + stl++; + if (atoi((char *)stl)) + while (VIM_ISDIGIT(*stl)) + stl++; + if (*stl++ != '(') + stl = p_ruf; } #ifdef FEAT_VERTSPLIT col = ru_col - (Columns - W_WIDTH(wp)); @@ -6081,9 +6095,9 @@ win_redr_custom(wp, draw_ruler) else { if (*wp->w_p_stl != NUL) - p = wp->w_p_stl; + stl = wp->w_p_stl; else - p = p_stl; + stl = p_stl; # ifdef FEAT_EVAL use_sandbox = was_set_insecurely((char_u *)"statusline", *wp->w_p_stl == NUL ? 0 : OPT_LOCAL); @@ -6098,10 +6112,14 @@ win_redr_custom(wp, draw_ruler) if (maxwidth <= 0) return; + /* Make a copy, because the statusline may include a function call that + * might change the option value and free the memory. */ + stl = vim_strsave(stl); width = build_stl_str_hl(wp == NULL ? curwin : wp, buf, sizeof(buf), - p, use_sandbox, + stl, use_sandbox, fillchar, maxwidth, hltab, tabtab); + vim_free(stl); len = (int)STRLEN(buf); while (width < maxwidth && len < (int)sizeof(buf) - 1) @@ -9465,7 +9483,7 @@ showruler(always) #if defined(FEAT_STL_OPT) && defined(FEAT_WINDOWS) if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height) { - redraw_custum_statusline(curwin); + redraw_custom_statusline(curwin); } else #endif diff --git a/src/version.c b/src/version.c index 80bdb240b5..a4214fc96f 100644 --- a/src/version.c +++ b/src/version.c @@ -676,6 +676,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 280, /**/ 279, /**/ -- cgit v1.2.3