summaryrefslogtreecommitdiffstats
path: root/src/edit.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-09-04 16:35:35 +0200
committerBram Moolenaar <Bram@vim.org>2020-09-04 16:35:35 +0200
commit077cc7aa0e0c431e97795612374fe17fe7c88803 (patch)
tree80843d4928d91ca5f9d4c38d37807e0eb17bc4be /src/edit.c
parenteadee486c70946ad0e1746d77898d6f4f4acc817 (diff)
patch 8.2.1588: cannot read back the prompt of a prompt bufferv8.2.1588
Problem: Cannot read back the prompt of a prompt buffer. Solution: Add prompt_getprompt(). (Ben Jackson, closes #6851)
Diffstat (limited to 'src/edit.c')
-rw-r--r--src/edit.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/edit.c b/src/edit.c
index dc0b45082d..bc74f44bb4 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1682,16 +1682,26 @@ 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.