diff src/edit.c @ 22077:335365fcbb60 v8.2.1588

patch 8.2.1588: cannot read back the prompt of a prompt buffer Commit: https://github.com/vim/vim/commit/077cc7aa0e0c431e97795612374fe17fe7c88803 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 4 16:35:35 2020 +0200 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 https://github.com/vim/vim/issues/6851)
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Sep 2020 16:45:04 +0200
parents 5ffe112b1afd
children 9bb1c984c4da
line wrap: on
line diff
--- 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.