0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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 #6851)
This commit is contained in:
Bram Moolenaar
2020-09-04 16:35:35 +02:00
parent eadee486c7
commit 077cc7aa0e
10 changed files with 97 additions and 6 deletions

View File

@@ -1681,17 +1681,27 @@ edit_putchar(int c, int highlight)
}
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
/*
* Return the effective prompt for the specified buffer.
*/
char_u *
buf_prompt_text(buf_T* buf)
{
if (buf->b_prompt_text == NULL)
return (char_u *)"% ";
return buf->b_prompt_text;
}
/*
* Return the effective prompt for the current buffer.
*/
char_u *
prompt_text(void)
{
if (curbuf->b_prompt_text == NULL)
return (char_u *)"% ";
return curbuf->b_prompt_text;
return buf_prompt_text(curbuf);
}
/*
* Prepare for prompt mode: Make sure the last line has the prompt text.
* Move the cursor to this line.