Skip to content

Commit 7a43cb9

Browse files
committed
patch 8.0.0476: missing change to main.c
Problem: Missing change to main.c. Solution: Add new function.
1 parent 7416f3e commit 7a43cb9

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/main.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4140,6 +4140,11 @@ eval_client_expr_to_string(char_u *expr)
41404140
char_u *res;
41414141
int save_dbl = debug_break_level;
41424142
int save_ro = redir_off;
4143+
void *fc;
4144+
4145+
/* Evaluate the expression at the toplevel, don't use variables local to
4146+
* the calling function. */
4147+
fc = clear_current_funccal();
41434148

41444149
/* Disable debugging, otherwise Vim hangs, waiting for "cont" to be
41454150
* typed. */
@@ -4156,6 +4161,7 @@ eval_client_expr_to_string(char_u *expr)
41564161
--emsg_silent;
41574162
if (emsg_silent < 0)
41584163
emsg_silent = 0;
4164+
restore_current_funccal(fc);
41594165

41604166
/* A client can tell us to redraw, but not to display the cursor, so do
41614167
* that here. */
@@ -4169,6 +4175,41 @@ eval_client_expr_to_string(char_u *expr)
41694175
return res;
41704176
}
41714177

4178+
/*
4179+
* Evaluate a command or expression sent to ourselves.
4180+
*/
4181+
int
4182+
sendToLocalVim(char_u *cmd, int asExpr, char_u **result)
4183+
{
4184+
if (asExpr)
4185+
{
4186+
char_u *ret;
4187+
4188+
ret = eval_client_expr_to_string(cmd);
4189+
if (result != NULL)
4190+
{
4191+
if (ret == NULL)
4192+
{
4193+
char *err = _(e_invexprmsg);
4194+
size_t len = STRLEN(cmd) + STRLEN(err) + 5;
4195+
char_u *msg;
4196+
4197+
msg = alloc(len);
4198+
if (msg != NULL)
4199+
vim_snprintf((char *)msg, len, "%s: \"%s\"", err, cmd);
4200+
*result = msg;
4201+
}
4202+
else
4203+
*result = ret;
4204+
}
4205+
else
4206+
vim_free(ret);
4207+
return ret == NULL ? -1 : 0;
4208+
}
4209+
server_to_input_buf(cmd);
4210+
return 0;
4211+
}
4212+
41724213
/*
41734214
* If conversion is needed, convert "data" from "client_enc" to 'encoding' and
41744215
* return an allocated string. Otherwise return "data".

src/version.c

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

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
476,
767769
/**/
768770
475,
769771
/**/

0 commit comments

Comments
 (0)