aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/edit.c
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-04-14 20:13:22 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-04-21 14:55:04 +0100
commit65f35e0c7db700c25d9de9a3c8637f720c07583a (patch)
tree57ac945230ad1271c337d38256147e5f2e67bd33 /src/nvim/edit.c
parent805eb81ccdc6a7000926e458b6e0dd59df16a112 (diff)
downloadrneovim-65f35e0c7db700c25d9de9a3c8637f720c07583a.tar.gz
rneovim-65f35e0c7db700c25d9de9a3c8637f720c07583a.tar.bz2
rneovim-65f35e0c7db700c25d9de9a3c8637f720c07583a.zip
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) https://github.com/vim/vim/commit/077cc7aa0e0c431e97795612374fe17fe7c88803 Updated prompt_getprompt() doc to https://github.com/vim/vim/commit/cb80aa2d53e56d3aba3b3c439fb467f29a750c5e and removed mention of method syntax usage (not supported by Nvim).
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r--src/nvim/edit.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index f2fddc89fe..999cc74185 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1604,13 +1604,20 @@ void edit_putchar(int c, bool highlight)
}
}
+/// Return the effective prompt for the specified buffer.
+char_u *buf_prompt_text(const buf_T *const buf)
+ FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
+{
+ 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)
+char_u *prompt_text(void) FUNC_ATTR_WARN_UNUSED_RESULT
{
- 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.