diff --git a/src/evalfunc.c b/src/evalfunc.c index 2b2c8a0976..eba0efff86 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -12456,7 +12456,7 @@ f_timer_start(typval_T *argvars, typval_T *rettv) free_callback(callback, partial); else { - if (timer->tr_partial == NULL) + if (partial == NULL) timer->tr_callback = vim_strsave(callback); else /* pointer into the partial */ diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 8f4d5f3f6f..0e25186779 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -1143,10 +1143,11 @@ free_timer(timer_T *timer) create_timer(long msec, int repeat) { timer_T *timer = (timer_T *)alloc_clear(sizeof(timer_T)); + long prev_id = last_timer_id; if (timer == NULL) return NULL; - if (++last_timer_id < 0) + if (++last_timer_id <= prev_id) /* Overflow! Might cause duplicates... */ last_timer_id = 0; timer->tr_id = last_timer_id; diff --git a/src/misc1.c b/src/misc1.c index 9a4d3ec3a0..3b59dd0f62 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -6103,7 +6103,7 @@ cin_isterminated( * When a line ends in a comma we continue looking in the next line. * "sp" points to a string with the line. When looking at other lines it must * be restored to the line. When it's NULL fetch lines here. - * "lnum" is where we start looking. + * "first_lnum" is where we start looking. * "min_lnum" is the line before which we will not be looking. */ static int @@ -6114,6 +6114,7 @@ cin_isfuncdecl( { char_u *s; linenr_T lnum = first_lnum; + linenr_T save_lnum = curwin->w_cursor.lnum; int retval = FALSE; pos_T *trypos; int just_started = TRUE; @@ -6123,15 +6124,20 @@ cin_isfuncdecl( else s = *sp; + curwin->w_cursor.lnum = lnum; if (find_last_paren(s, '(', ')') && (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL) { lnum = trypos->lnum; if (lnum < min_lnum) + { + curwin->w_cursor.lnum = save_lnum; return FALSE; + } s = ml_get(lnum); } + curwin->w_cursor.lnum = save_lnum; /* Ignore line starting with #. */ if (cin_ispreproc(s)) @@ -6687,7 +6693,7 @@ find_start_brace(void) /* XXX */ static pos_T * find_match_paren(int ind_maxparen) /* XXX */ { - return find_match_char('(', ind_maxparen); + return find_match_char('(', ind_maxparen); } static pos_T * diff --git a/src/testdir/test_timers.vim b/src/testdir/test_timers.vim index 558fe69988..e96ad59dc9 100644 --- a/src/testdir/test_timers.vim +++ b/src/testdir/test_timers.vim @@ -48,12 +48,12 @@ endfunc func Test_with_partial_callback() let g:val = 0 - let s:meow = {} - function s:meow.bite(...) - let g:val += 1 + let meow = {'one': 1} + function meow.bite(...) + let g:val += self.one endfunction - call timer_start(50, s:meow.bite) + call timer_start(50, meow.bite) let slept = WaitFor('g:val == 1') call assert_equal(1, g:val) if has('reltime') diff --git a/src/version.c b/src/version.c index fb98467ac8..23f0b7aa61 100644 --- a/src/version.c +++ b/src/version.c @@ -778,6 +778,12 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2361, +/**/ + 2360, +/**/ + 2359, /**/ 2358, /**/