0
0
mirror of https://github.com/vim/vim.git synced 2025-10-14 07:04:10 -04:00

patch 8.0.0015

Problem:    Can't tell which part of a channel has "buffered" status.
Solution:   Add an optional argument to ch_status().  Let ch_info() also
            return "buffered" for out_status and err_status.
This commit is contained in:
Bram Moolenaar
2016-09-26 22:36:58 +02:00
parent 1eceadaf48
commit 7ef3810d28
6 changed files with 82 additions and 19 deletions

View File

@@ -514,7 +514,7 @@ static struct fst
{"ch_sendexpr", 2, 3, f_ch_sendexpr},
{"ch_sendraw", 2, 3, f_ch_sendraw},
{"ch_setoptions", 2, 2, f_ch_setoptions},
{"ch_status", 1, 1, f_ch_status},
{"ch_status", 1, 2, f_ch_status},
#endif
{"changenr", 0, 0, f_changenr},
{"char2nr", 1, 2, f_char2nr},
@@ -1985,13 +1985,24 @@ f_ch_setoptions(typval_T *argvars, typval_T *rettv UNUSED)
f_ch_status(typval_T *argvars, typval_T *rettv)
{
channel_T *channel;
jobopt_T opt;
int part = -1;
/* return an empty string by default */
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
channel = get_channel_arg(&argvars[0], FALSE, FALSE, 0);
rettv->vval.v_string = vim_strsave((char_u *)channel_status(channel));
if (argvars[1].v_type != VAR_UNKNOWN)
{
clear_job_options(&opt);
if (get_job_options(&argvars[1], &opt, JO_PART) == OK
&& (opt.jo_set & JO_PART))
part = opt.jo_part;
}
rettv->vval.v_string = vim_strsave((char_u *)channel_status(channel, part));
}
#endif