Skip to content

Commit 4c0698e

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 46e2f36 + e723c42 commit 4c0698e

7 files changed

Lines changed: 64 additions & 16 deletions

File tree

nsis/gvim.nsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,14 @@ Section "Vim executables and runtime files"
219219

220220
SetOutPath $0\macros
221221
File ${VIMRT}\macros\*.*
222+
SetOutPath $0\macros\hanoi
223+
File ${VIMRT}\macros\hanoi\*.*
224+
SetOutPath $0\macros\life
225+
File ${VIMRT}\macros\life\*.*
226+
SetOutPath $0\macros\maze
227+
File ${VIMRT}\macros\maze\*.*
228+
SetOutPath $0\macros\urm
229+
File ${VIMRT}\macros\urm\*.*
222230

223231
SetOutPath $0\pack\dist\opt\dvorak\dvorak
224232
File ${VIMRT}\pack\dist\opt\dvorak\dvorak\*.*

src/ex_cmds2.c

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,30 +1219,40 @@ check_due_timer(void)
12191219
{
12201220
int save_timer_busy = timer_busy;
12211221
int save_vgetc_busy = vgetc_busy;
1222-
int did_emsg_save = did_emsg;
1223-
int called_emsg_save = called_emsg;
1224-
int did_throw_save = did_throw;
1222+
int save_did_emsg = did_emsg;
1223+
int save_called_emsg = called_emsg;
12251224
int save_must_redraw = must_redraw;
1225+
int save_trylevel = trylevel;
1226+
int save_did_throw = did_throw;
1227+
except_T *save_current_exception = current_exception;
12261228

1229+
/* Create a scope for running the timer callback, ignoring most of
1230+
* the current scope, such as being inside a try/catch. */
12271231
timer_busy = timer_busy > 0 || vgetc_busy > 0;
12281232
vgetc_busy = 0;
12291233
called_emsg = FALSE;
1234+
did_emsg = FALSE;
1235+
did_uncaught_emsg = FALSE;
12301236
must_redraw = 0;
1237+
trylevel = 0;
1238+
did_throw = FALSE;
1239+
current_exception = NULL;
1240+
12311241
timer->tr_firing = TRUE;
12321242
timer_callback(timer);
12331243
timer->tr_firing = FALSE;
1244+
12341245
timer_next = timer->tr_next;
12351246
did_one = TRUE;
12361247
timer_busy = save_timer_busy;
12371248
vgetc_busy = save_vgetc_busy;
1238-
if (called_emsg)
1239-
{
1249+
if (did_uncaught_emsg)
12401250
++timer->tr_emsg_count;
1241-
if (!did_throw_save && did_throw && current_exception != NULL)
1242-
discard_current_exception();
1243-
}
1244-
did_emsg = did_emsg_save;
1245-
called_emsg = called_emsg_save;
1251+
did_emsg = save_did_emsg;
1252+
called_emsg = save_called_emsg;
1253+
trylevel = save_trylevel;
1254+
did_throw = save_did_throw;
1255+
current_exception = save_current_exception;
12461256
if (must_redraw != 0)
12471257
need_update_screen = TRUE;
12481258
must_redraw = must_redraw > save_must_redraw

src/globals.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ EXTERN dict_T globvardict; /* Dictionary with g: variables */
182182
#endif
183183
EXTERN int did_emsg; /* set by emsg() when the message
184184
is displayed or thrown */
185+
#ifdef FEAT_EVAL
186+
EXTERN int did_uncaught_emsg; /* emsg() was called and did not
187+
cause an exception */
188+
#endif
185189
EXTERN int did_emsg_syntax; /* did_emsg set because of a
186190
syntax error */
187191
EXTERN int called_emsg; /* always set by emsg() */

src/message.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -609,11 +609,9 @@ emsg(char_u *s)
609609

610610
called_emsg = TRUE;
611611

612-
/*
613-
* If "emsg_severe" is TRUE: When an error exception is to be thrown,
614-
* prefer this message over previous messages for the same command.
615-
*/
616612
#ifdef FEAT_EVAL
613+
/* If "emsg_severe" is TRUE: When an error exception is to be thrown,
614+
* prefer this message over previous messages for the same command. */
617615
severe = emsg_severe;
618616
emsg_severe = FALSE;
619617
#endif
@@ -684,6 +682,9 @@ emsg(char_u *s)
684682
else
685683
flush_buffers(FALSE); /* flush internal buffers */
686684
did_emsg = TRUE; /* flag for DoOneCmd() */
685+
#ifdef FEAT_EVAL
686+
did_uncaught_emsg = TRUE;
687+
#endif
687688
}
688689

689690
emsg_on_display = TRUE; /* remember there is an error message */

src/term.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4586,9 +4586,10 @@ check_termcode(
45864586
if (col >= 2500)
45874587
is_not_xterm = TRUE;
45884588

4589-
/* PuTTY sends 0;136;0 */
4589+
/* PuTTY sends 0;136;0
4590+
* vandyke SecureCRT sends 1;136;0 */
45904591
if (version == 136
4591-
&& STRNCMP(tp + extra - 2, "0;136;0c", 8) == 0)
4592+
&& STRNCMP(tp + extra - 3, ";136;0c", 8) == 0)
45924593
is_not_xterm = TRUE;
45934594

45944595
/* Konsole sends 0;115;0 */

src/testdir/test_timers.vim

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,24 @@ func Test_timer_errors()
208208
call assert_equal(3, g:call_count)
209209
endfunc
210210

211+
func FuncWithCaughtError(timer)
212+
let g:call_count += 1
213+
try
214+
doesnotexist
215+
catch
216+
" nop
217+
endtry
218+
endfunc
219+
220+
func Test_timer_catch_error()
221+
let g:call_count = 0
222+
let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4})
223+
" Timer will not be stopped.
224+
call WaitFor('g:call_count == 4')
225+
sleep 50m
226+
call assert_equal(4, g:call_count)
227+
endfunc
228+
211229
func FeedAndPeek(timer)
212230
call test_feedinput('a')
213231
call getchar(1)

src/version.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,12 @@ static char *(features[]) =
784784

785785
static int included_patches[] =
786786
{ /* Add new patch number below this line */
787+
/**/
788+
1067,
789+
/**/
790+
1066,
791+
/**/
792+
1065,
787793
/**/
788794
1064,
789795
/**/

0 commit comments

Comments
 (0)