Skip to content

Commit 374f09f

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents b5e634e + e56bf15 commit 374f09f

4 files changed

Lines changed: 28 additions & 12 deletions

File tree

src/channel.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ typedef struct {
119119

120120
void (*ch_close_cb)(void); /* callback for when channel is closed */
121121

122+
int ch_block_id; /* ID that channel_read_json_block() is
123+
waiting for */
122124
char_u *ch_callback; /* function to call when a msg is not handled */
123125
cbq_T ch_cb_head; /* dummy node for pre-request callbacks */
124126

@@ -790,23 +792,26 @@ remove_json_node(jsonq_T *node)
790792
/*
791793
* Get a message from the JSON queue for channel "ch_idx".
792794
* When "id" is positive it must match the first number in the list.
793-
* When "id" is zero or negative jut get the first message.
795+
* When "id" is zero or negative jut get the first message. But not the one
796+
* with id ch_block_id.
794797
* Return OK when found and return the value in "rettv".
795798
* Return FAIL otherwise.
796799
*/
797800
static int
798801
channel_get_json(int ch_idx, int id, typval_T **rettv)
799802
{
800-
jsonq_T *head = &channels[ch_idx].ch_json_head;
801-
jsonq_T *item = head->next;
803+
channel_T *channel = &channels[ch_idx];
804+
jsonq_T *head = &channel->ch_json_head;
805+
jsonq_T *item = head->next;
802806

803807
while (item != head)
804808
{
805809
list_T *l = item->value->vval.v_list;
806810
typval_T *tv = &l->lv_first->li_tv;
807811

808812
if ((id > 0 && tv->v_type == VAR_NUMBER && tv->vval.v_number == id)
809-
|| id <= 0)
813+
|| (id <= 0 && (tv->v_type != VAR_NUMBER
814+
|| tv->vval.v_number != channel->ch_block_id)))
810815
{
811816
*rettv = item->value;
812817
remove_json_node(item);
@@ -1316,15 +1321,20 @@ channel_read_block(int idx)
13161321
int
13171322
channel_read_json_block(int ch_idx, int id, typval_T **rettv)
13181323
{
1319-
int more;
1324+
int more;
1325+
channel_T *channel = &channels[ch_idx];
13201326

1327+
channel->ch_block_id = id;
13211328
for (;;)
13221329
{
13231330
more = channel_parse_json(ch_idx);
13241331

13251332
/* search for messsage "id" */
13261333
if (channel_get_json(ch_idx, id, rettv) == OK)
1334+
{
1335+
channel->ch_block_id = 0;
13271336
return OK;
1337+
}
13281338

13291339
if (!more)
13301340
{
@@ -1334,13 +1344,13 @@ channel_read_json_block(int ch_idx, int id, typval_T **rettv)
13341344
continue;
13351345

13361346
/* Wait for up to the channel timeout. */
1337-
if (channels[ch_idx].ch_fd < 0
1338-
|| channel_wait(channels[ch_idx].ch_fd,
1339-
channels[ch_idx].ch_timeout) == FAIL)
1347+
if (channel->ch_fd < 0 || channel_wait(channel->ch_fd,
1348+
channel->ch_timeout) == FAIL)
13401349
break;
13411350
channel_read(ch_idx);
13421351
}
13431352
}
1353+
channel->ch_block_id = 0;
13441354
return FAIL;
13451355
}
13461356

src/eval.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10611,7 +10611,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
1061110611
static void
1061210612
f_empty(typval_T *argvars, typval_T *rettv)
1061310613
{
10614-
int n;
10614+
int n = FALSE;
1061510615

1061610616
switch (argvars[0].v_type)
1061710617
{
@@ -19962,7 +19962,7 @@ f_trunc(typval_T *argvars, typval_T *rettv)
1996219962
static void
1996319963
f_type(typval_T *argvars, typval_T *rettv)
1996419964
{
19965-
int n;
19965+
int n = -1;
1996619966

1996719967
switch (argvars[0].v_type)
1996819968
{
@@ -24979,7 +24979,7 @@ write_viminfo_varlist(FILE *fp)
2497924979
hashitem_T *hi;
2498024980
dictitem_T *this_var;
2498124981
int todo;
24982-
char *s;
24982+
char *s = "";
2498324983
char_u *p;
2498424984
char_u *tofree;
2498524985
char_u numbuf[NUMBUFLEN];

src/testdir/test_channel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def handle(self):
133133
elif decoded[1] == '!quit!':
134134
# we're done
135135
self.server.shutdown()
136-
break
136+
return
137137
elif decoded[1] == '!crash!':
138138
# Crash!
139139
42 / 0

src/version.c

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

763763
static int included_patches[] =
764764
{ /* Add new patch number below this line */
765+
/**/
766+
1293,
767+
/**/
768+
1292,
769+
/**/
770+
1291,
765771
/**/
766772
1290,
767773
/**/

0 commit comments

Comments
 (0)