Skip to content

Commit f23cfce

Browse files
committed
updated for version 7.3.594
Problem: The X command server doesn't work perfectly. It sends an empty reply for as-keys requests. Solution: Remove duplicate ga_init2(). Do not send a reply for as-keys requests. (Brian Burns)
1 parent 4f818ee commit f23cfce

File tree

2 files changed

+45
-43
lines changed

2 files changed

+45
-43
lines changed

src/if_xcmdsrv.c

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,6 @@ serverGetVimNames(dpy)
655655
if (SendInit(dpy) < 0)
656656
return NULL;
657657
}
658-
ga_init2(&ga, 1, 100);
659658

660659
/*
661660
* Read the registry property.
@@ -1198,9 +1197,8 @@ serverEventProc(dpy, eventPtr)
11981197
if ((*p == 'c' || *p == 'k') && (p[1] == 0))
11991198
{
12001199
Window resWindow;
1201-
char_u *name, *script, *serial, *end, *res;
1200+
char_u *name, *script, *serial, *end;
12021201
Bool asKeys = *p == 'k';
1203-
garray_T reply;
12041202
char_u *enc;
12051203

12061204
/*
@@ -1256,50 +1254,52 @@ serverEventProc(dpy, eventPtr)
12561254
if (script == NULL || name == NULL)
12571255
continue;
12581256

1259-
/*
1260-
* Initialize the result property, so that we're ready at any
1261-
* time if we need to return an error.
1262-
*/
1263-
if (resWindow != None)
1264-
{
1265-
ga_init2(&reply, 1, 100);
1257+
if (serverName != NULL && STRICMP(name, serverName) == 0)
1258+
{
1259+
script = serverConvert(enc, script, &tofree);
1260+
if (asKeys)
1261+
server_to_input_buf(script);
1262+
else
1263+
{
1264+
char_u *res;
1265+
1266+
res = eval_client_expr_to_string(script);
1267+
if (resWindow != None)
1268+
{
1269+
garray_T reply;
1270+
1271+
/* Initialize the result property. */
1272+
ga_init2(&reply, 1, 100);
12661273
#ifdef FEAT_MBYTE
1267-
ga_grow(&reply, 50 + STRLEN(p_enc));
1268-
sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ",
1274+
ga_grow(&reply, 50 + STRLEN(p_enc));
1275+
sprintf(reply.ga_data, "%cr%c-E %s%c-s %s%c-r ",
12691276
0, 0, p_enc, 0, serial, 0);
1270-
reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial);
1277+
reply.ga_len = 14 + STRLEN(p_enc) + STRLEN(serial);
12711278
#else
1272-
ga_grow(&reply, 50);
1273-
sprintf(reply.ga_data, "%cr%c-s %s%c-r ", 0, 0, serial, 0);
1274-
reply.ga_len = 10 + STRLEN(serial);
1279+
ga_grow(&reply, 50);
1280+
sprintf(reply.ga_data, "%cr%c-s %s%c-r ",
1281+
0, 0, serial, 0);
1282+
reply.ga_len = 10 + STRLEN(serial);
12751283
#endif
1276-
}
1277-
res = NULL;
1278-
if (serverName != NULL && STRICMP(name, serverName) == 0)
1279-
{
1280-
script = serverConvert(enc, script, &tofree);
1281-
if (asKeys)
1282-
server_to_input_buf(script);
1283-
else
1284-
res = eval_client_expr_to_string(script);
1285-
vim_free(tofree);
1286-
}
1287-
if (resWindow != None)
1288-
{
1289-
if (res != NULL)
1290-
ga_concat(&reply, res);
1291-
else if (asKeys == 0)
1292-
{
1293-
ga_concat(&reply, (char_u *)_(e_invexprmsg));
1294-
ga_append(&reply, 0);
1295-
ga_concat(&reply, (char_u *)"-c 1");
1296-
}
1297-
ga_append(&reply, NUL);
1298-
(void)AppendPropCarefully(dpy, resWindow, commProperty,
1299-
reply.ga_data, reply.ga_len);
1300-
ga_clear(&reply);
1301-
}
1302-
vim_free(res);
1284+
1285+
/* Evaluate the expression and return the result. */
1286+
if (res != NULL)
1287+
ga_concat(&reply, res);
1288+
else
1289+
{
1290+
ga_concat(&reply, (char_u *)_(e_invexprmsg));
1291+
ga_append(&reply, 0);
1292+
ga_concat(&reply, (char_u *)"-c 1");
1293+
}
1294+
ga_append(&reply, NUL);
1295+
(void)AppendPropCarefully(dpy, resWindow, commProperty,
1296+
reply.ga_data, reply.ga_len);
1297+
ga_clear(&reply);
1298+
}
1299+
vim_free(res);
1300+
}
1301+
vim_free(tofree);
1302+
}
13031303
}
13041304
else if (*p == 'r' && p[1] == 0)
13051305
{

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,8 @@ static char *(features[]) =
714714

715715
static int included_patches[] =
716716
{ /* Add new patch number below this line */
717+
/**/
718+
594,
717719
/**/
718720
593,
719721
/**/

0 commit comments

Comments
 (0)