Skip to content

Commit 2b4671c

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents 8287abd + ee39ef0 commit 2b4671c

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12456,7 +12456,7 @@ f_timer_start(typval_T *argvars, typval_T *rettv)
1245612456
free_callback(callback, partial);
1245712457
else
1245812458
{
12459-
if (timer->tr_partial == NULL)
12459+
if (partial == NULL)
1246012460
timer->tr_callback = vim_strsave(callback);
1246112461
else
1246212462
/* pointer into the partial */

src/ex_cmds2.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,10 +1143,11 @@ free_timer(timer_T *timer)
11431143
create_timer(long msec, int repeat)
11441144
{
11451145
timer_T *timer = (timer_T *)alloc_clear(sizeof(timer_T));
1146+
long prev_id = last_timer_id;
11461147

11471148
if (timer == NULL)
11481149
return NULL;
1149-
if (++last_timer_id < 0)
1150+
if (++last_timer_id <= prev_id)
11501151
/* Overflow! Might cause duplicates... */
11511152
last_timer_id = 0;
11521153
timer->tr_id = last_timer_id;

src/misc1.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6103,7 +6103,7 @@ cin_isterminated(
61036103
* When a line ends in a comma we continue looking in the next line.
61046104
* "sp" points to a string with the line. When looking at other lines it must
61056105
* be restored to the line. When it's NULL fetch lines here.
6106-
* "lnum" is where we start looking.
6106+
* "first_lnum" is where we start looking.
61076107
* "min_lnum" is the line before which we will not be looking.
61086108
*/
61096109
static int
@@ -6114,6 +6114,7 @@ cin_isfuncdecl(
61146114
{
61156115
char_u *s;
61166116
linenr_T lnum = first_lnum;
6117+
linenr_T save_lnum = curwin->w_cursor.lnum;
61176118
int retval = FALSE;
61186119
pos_T *trypos;
61196120
int just_started = TRUE;
@@ -6123,15 +6124,20 @@ cin_isfuncdecl(
61236124
else
61246125
s = *sp;
61256126

6127+
curwin->w_cursor.lnum = lnum;
61266128
if (find_last_paren(s, '(', ')')
61276129
&& (trypos = find_match_paren(curbuf->b_ind_maxparen)) != NULL)
61286130
{
61296131
lnum = trypos->lnum;
61306132
if (lnum < min_lnum)
6133+
{
6134+
curwin->w_cursor.lnum = save_lnum;
61316135
return FALSE;
6136+
}
61326137

61336138
s = ml_get(lnum);
61346139
}
6140+
curwin->w_cursor.lnum = save_lnum;
61356141

61366142
/* Ignore line starting with #. */
61376143
if (cin_ispreproc(s))
@@ -6687,7 +6693,7 @@ find_start_brace(void) /* XXX */
66876693
static pos_T *
66886694
find_match_paren(int ind_maxparen) /* XXX */
66896695
{
6690-
return find_match_char('(', ind_maxparen);
6696+
return find_match_char('(', ind_maxparen);
66916697
}
66926698

66936699
static pos_T *

src/testdir/test_timers.vim

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ endfunc
4848

4949
func Test_with_partial_callback()
5050
let g:val = 0
51-
let s:meow = {}
52-
function s:meow.bite(...)
53-
let g:val += 1
51+
let meow = {'one': 1}
52+
function meow.bite(...)
53+
let g:val += self.one
5454
endfunction
5555

56-
call timer_start(50, s:meow.bite)
56+
call timer_start(50, meow.bite)
5757
let slept = WaitFor('g:val == 1')
5858
call assert_equal(1, g:val)
5959
if has('reltime')

src/version.c

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

779779
static int included_patches[] =
780780
{ /* Add new patch number below this line */
781+
/**/
782+
2361,
783+
/**/
784+
2360,
785+
/**/
786+
2359,
781787
/**/
782788
2358,
783789
/**/

0 commit comments

Comments
 (0)