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)
diff --git a/src/edit.c b/src/edit.c
index dc0b450..bc74f44 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -1682,16 +1682,26 @@
#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.