Patch 7.4.1711
Problem:    When using try/catch in 'statusline' it is still considered an
            error and the status line will be disabled.
Solution:   Check did_emsg instead of called_emsg. (haya14busa, closes #729)
Files:      src/screen.c, src/testdir/test_statusline.vim,
            src/testdir/test_alot.vim


*** ../vim-7.4.1710/src/screen.c        2016-04-02 22:14:47.074253291 +0200
--- src/screen.c        2016-04-04 23:05:55.534919538 +0200
***************
*** 6779,6785 ****
  redraw_custom_statusline(win_T *wp)
  {
      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. */
--- 6779,6785 ----
  redraw_custom_statusline(win_T *wp)
  {
      static int            entered = FALSE;
!     int                   saved_did_emsg = did_emsg;
  
      /* When called recursively return.  This can happen when the statusline
       * contains an expression that triggers a redraw. */
***************
*** 6787,6795 ****
        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
--- 6787,6795 ----
        return;
      entered = TRUE;
  
!     did_emsg = FALSE;
      win_redr_custom(wp, FALSE);
!     if (did_emsg)
      {
        /* When there is an error disable the statusline, otherwise the
         * display is messed up with errors and a redraw triggers the problem
***************
*** 6798,6804 ****
                (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
                                        ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
      }
!     called_emsg |= save_called_emsg;
      entered = FALSE;
  }
  #endif
--- 6798,6804 ----
                (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
                                        ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
      }
!     did_emsg |= saved_did_emsg;
      entered = FALSE;
  }
  #endif
*** ../vim-7.4.1710/src/testdir/test_statusline.vim     2016-04-05 
21:09:32.794050404 +0200
--- src/testdir/test_statusline.vim     2016-04-04 23:03:08.848716184 +0200
***************
*** 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
*** ../vim-7.4.1710/src/testdir/test_alot.vim   2016-03-29 23:10:14.014448074 
+0200
--- src/testdir/test_alot.vim   2016-04-04 23:03:26.896521514 +0200
***************
*** 22,27 ****
--- 22,28 ----
  source test_searchpos.vim
  source test_set.vim
  source test_sort.vim
+ source test_statusline.vim
  source test_syn_attr.vim
  source test_timers.vim
  source test_undolevels.vim
*** ../vim-7.4.1710/src/version.c       2016-04-04 22:03:04.254923521 +0200
--- src/version.c       2016-04-05 21:09:42.293953746 +0200
***************
*** 750,751 ****
--- 750,753 ----
  {   /* Add new patch number below this line */
+ /**/
+     1711,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
227. You sleep next to your monitor.  Or on top of it.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui