Merge pull request #5665 from brcolow/vim-7.4.1711

vim-patch:7.4.1711
This commit is contained in:
James McCoy 2016-12-01 09:01:55 -05:00
commit e1cdf04f2d
4 changed files with 51 additions and 11 deletions

View File

@ -4939,8 +4939,8 @@ void win_redr_status(win_T *wp)
*/ */
static void redraw_custom_statusline(win_T *wp) static void redraw_custom_statusline(win_T *wp)
{ {
static int entered = FALSE; static int entered = false;
int save_called_emsg = called_emsg; int saved_did_emsg = did_emsg;
/* When called recursively return. This can happen when the statusline /* When called recursively return. This can happen when the statusline
* contains an expression that triggers a redraw. */ * contains an expression that triggers a redraw. */
@ -4948,18 +4948,18 @@ static void redraw_custom_statusline(win_T *wp)
return; return;
entered = TRUE; entered = TRUE;
called_emsg = FALSE; did_emsg = false;
win_redr_custom(wp, FALSE); win_redr_custom(wp, false);
if (called_emsg) { if (did_emsg) {
/* When there is an error disable the statusline, otherwise the // When there is an error disable the statusline, otherwise the
* display is messed up with errors and a redraw triggers the problem // display is messed up with errors and a redraw triggers the problem
* again and again. */ // again and again.
set_string_option_direct((char_u *)"statusline", -1, set_string_option_direct((char_u *)"statusline", -1,
(char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR); ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
} }
called_emsg |= save_called_emsg; did_emsg |= saved_did_emsg;
entered = FALSE; entered = false;
} }
/* /*

View File

@ -12,6 +12,7 @@ source test_menu.vim
source test_options.vim source test_options.vim
source test_popup.vim source test_popup.vim
source test_regexp_utf8.vim source test_regexp_utf8.vim
source test_statusline.vim
source test_syn_attr.vim source test_syn_attr.vim
source test_tabpage.vim source test_tabpage.vim
source test_unlet.vim source test_unlet.vim

View File

@ -0,0 +1,39 @@
function! StatuslineWithCaughtError()
let s:func_in_statusline_called = 1
try
call eval('unknown expression')
catch
endtry
return ''
endfunction
function! StatuslineWithError()
let s:func_in_statusline_called = 1
call eval('unknown expression')
return ''
endfunction
function! Test_caught_error_in_statusline()
let s:func_in_statusline_called = 0
set laststatus=2
let statusline = '%{StatuslineWithCaughtError()}'
let &statusline = statusline
redrawstatus
call assert_true(s:func_in_statusline_called)
call assert_equal(statusline, &statusline)
set statusline=
endfunction
function! Test_statusline_will_be_disabled_with_error()
let s:func_in_statusline_called = 0
set laststatus=2
let statusline = '%{StatuslineWithError()}'
try
let &statusline = statusline
redrawstatus
catch
endtry
call assert_true(s:func_in_statusline_called)
call assert_equal('', &statusline)
set statusline=
endfunction

View File

@ -733,7 +733,7 @@ static int included_patches[] = {
1714, 1714,
// 1713 NA // 1713 NA
1712, 1712,
// 1711, 1711,
// 1710 NA // 1710 NA
// 1709 NA // 1709 NA
// 1708, // 1708,