diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-03-18 18:15:16 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-03-18 18:15:16 +0100 |
commit | 7a43cb9cb5909634469b0a3e865747f10ea38e9b (patch) | |
tree | 53695dcc7a9befa183f93e36a51396133f4198e7 | |
parent | 7416f3e73ab2c4e7ae3adc2ff6e70234f7d40d2e (diff) | |
download | vim-git-7a43cb9cb5909634469b0a3e865747f10ea38e9b.tar.gz |
patch 8.0.0476: missing change to main.cv8.0.0476
Problem: Missing change to main.c.
Solution: Add new function.
-rw-r--r-- | src/main.c | 41 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c index 29ab3c6e9..52370dc41 100644 --- a/src/main.c +++ b/src/main.c @@ -4140,6 +4140,11 @@ eval_client_expr_to_string(char_u *expr) char_u *res; int save_dbl = debug_break_level; int save_ro = redir_off; + void *fc; + + /* Evaluate the expression at the toplevel, don't use variables local to + * the calling function. */ + fc = clear_current_funccal(); /* Disable debugging, otherwise Vim hangs, waiting for "cont" to be * typed. */ @@ -4156,6 +4161,7 @@ eval_client_expr_to_string(char_u *expr) --emsg_silent; if (emsg_silent < 0) emsg_silent = 0; + restore_current_funccal(fc); /* A client can tell us to redraw, but not to display the cursor, so do * that here. */ @@ -4170,6 +4176,41 @@ eval_client_expr_to_string(char_u *expr) } /* + * Evaluate a command or expression sent to ourselves. + */ + int +sendToLocalVim(char_u *cmd, int asExpr, char_u **result) +{ + if (asExpr) + { + char_u *ret; + + ret = eval_client_expr_to_string(cmd); + if (result != NULL) + { + if (ret == NULL) + { + char *err = _(e_invexprmsg); + size_t len = STRLEN(cmd) + STRLEN(err) + 5; + char_u *msg; + + msg = alloc(len); + if (msg != NULL) + vim_snprintf((char *)msg, len, "%s: \"%s\"", err, cmd); + *result = msg; + } + else + *result = ret; + } + else + vim_free(ret); + return ret == NULL ? -1 : 0; + } + server_to_input_buf(cmd); + return 0; +} + +/* * If conversion is needed, convert "data" from "client_enc" to 'encoding' and * return an allocated string. Otherwise return "data". * "*tofree" is set to the result when it needs to be freed later. diff --git a/src/version.c b/src/version.c index 18ba30e87..b818b01ac 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 476, +/**/ 475, /**/ 474, |