0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.0181: problems parsing :term arguments

Problem:    Problems parsing :term arguments.
Solution:   Improve parsing, fix memory leak, add tests. (Ozaki Kiichi,
            closes #5536)
This commit is contained in:
Bram Moolenaar
2020-01-30 16:27:20 +01:00
parent 0c3064b39b
commit 21109272f5
6 changed files with 132 additions and 58 deletions

View File

@@ -595,9 +595,7 @@ term_start(
#if defined(FEAT_SESSION)
// Remember the command for the session file.
if (opt->jo_term_norestore || argv != NULL)
{
term->tl_command = vim_strsave((char_u *)"NONE");
}
else if (argvar->v_type == VAR_STRING)
{
char_u *cmd = argvar->vval.v_string;
@@ -646,7 +644,11 @@ term_start(
}
if (opt->jo_term_api != NULL)
term->tl_api = vim_strsave(opt->jo_term_api);
{
char_u *p = skiptowhite(opt->jo_term_api);
term->tl_api = vim_strnsave(opt->jo_term_api, p - opt->jo_term_api);
}
else
term->tl_api = vim_strsave((char_u *)"Tapi_");
@@ -778,6 +780,7 @@ ex_terminal(exarg_T *eap)
char_u *buf = NULL;
char_u *keys;
vim_free(opt.jo_eof_chars);
p = skiptowhite(cmd);
*p = NUL;
keys = replace_termcodes(ep + 1, &buf,
@@ -6697,7 +6700,7 @@ term_and_job_init(
#endif
// This may change a string in "argvar".
term->tl_job = job_start(argvar, argv, opt, TRUE);
term->tl_job = job_start(argvar, argv, opt, &term->tl_job);
if (term->tl_job != NULL)
++term->tl_job->jv_refcount;