mirror of
https://github.com/neovim/neovim.git
synced 2025-09-10 21:38:19 +00:00
vim-patch:8.2.1588: cannot read back the prompt of a prompt buffer
Problem: Cannot read back the prompt of a prompt buffer. Solution: Add prompt_getprompt(). (Ben Jackson, closes vim/vim#6851)077cc7aa0e
Updated prompt_getprompt() doc tocb80aa2d53
and removed mention of method syntax usage (not supported by Nvim).
This commit is contained in:
@@ -6491,6 +6491,26 @@ static void f_prompt_setinterrupt(typval_T *argvars,
|
||||
buf->b_prompt_interrupt= interrupt_callback;
|
||||
}
|
||||
|
||||
/// "prompt_getprompt({buffer})" function
|
||||
void f_prompt_getprompt(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
// return an empty string by default, e.g. it's not a prompt buffer
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
|
||||
buf_T *const buf = tv_get_buf_from_arg(&argvars[0]);
|
||||
if (buf == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!bt_prompt(buf)) {
|
||||
return;
|
||||
}
|
||||
|
||||
rettv->vval.v_string = vim_strsave(buf_prompt_text(buf));
|
||||
}
|
||||
|
||||
// "prompt_setprompt({buffer}, {text})" function
|
||||
static void f_prompt_setprompt(typval_T *argvars,
|
||||
typval_T *rettv, FunPtr fptr)
|
||||
|
Reference in New Issue
Block a user