patch 9.1.0500: cannot switch buffer in a popup
Problem: cannot switch buffer in a popup
(Yggdroot)
Solution: add popup_setbuf() function
fixes: #15006
closes: #15026
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index a824531..0061e9e 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -153,8 +153,8 @@
diff_hlID({lnum}, {col}) Number diff highlighting at {lnum}/{col}
digraph_get({chars}) String get the |digraph| of {chars}
digraph_getlist([{listall}]) List get all |digraph|s
-digraph_set({chars}, {digraph}) Boolean register |digraph|
-digraph_setlist({digraphlist}) Boolean register multiple |digraph|s
+digraph_set({chars}, {digraph}) Bool register |digraph|
+digraph_setlist({digraphlist}) Bool register multiple |digraph|s
echoraw({expr}) none output {expr} as-is
empty({expr}) Number |TRUE| if {expr} is empty
environ() Dict return environment variables
@@ -429,6 +429,7 @@
popup_move({id}, {options}) none set position of popup window {id}
popup_notification({what}, {options})
Number create a notification popup window
+popup_setbuf({id}, {buf}) Bool set the buffer for the popup window {id}
popup_setoptions({id}, {options})
none set options for popup window {id}
popup_settext({id}, {text}) none set the text of popup window {id}
diff --git a/runtime/doc/popup.txt b/runtime/doc/popup.txt
index 1ad4fb9..b9e992b 100644
--- a/runtime/doc/popup.txt
+++ b/runtime/doc/popup.txt
@@ -1,4 +1,4 @@
-*popup.txt* For Vim version 9.1. Last change: 2024 Jun 08
+*popup.txt* For Vim version 9.1. Last change: 2024 Jun 16
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -186,6 +186,7 @@
|popup_move()| change the position and size of a popup
|popup_setoptions()| override options of a popup
|popup_settext()| replace the popup buffer contents
+ |popup_setbuf()| set the buffer for the popup window
Closing popup windows:
|popup_close()| close one popup
@@ -574,6 +575,18 @@
Return type: |Number|
+popup_setbuf({id}, {buf}) *popup_setbuf()*
+ Set buffer {buf} to be displayed in popup win {id}. For the
+ use of {buf}, see |bufname()| function.
+ May change window size or position to adjust for the size
+ of the buffer text.
+
+ Can also be used as a |method|: >
+ GetPopup()->popup_setbuf(bufnr('foobar'))
+<
+ Return type: |vim9-boolean|
+
+
popup_setoptions({id}, {options}) *popup_setoptions()*
Override options in popup {id} with entries in {options}.
These options can be set:
@@ -613,9 +626,8 @@
popup_settext({id}, {text}) *popup_settext()*
- Set the text of the buffer in popup win {id}. {text} is the
- same as supplied to |popup_create()|, except that a buffer
- number is not allowed.
+ Set the text of the buffer in popup win {id}. {text} is
+ a string or a list of strings to be displayed in the popup.
Does not change the window size or position, other than caused
by the different text.
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 56385a8..ae83205 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -9433,6 +9433,7 @@
popup_menu-shortcut-example popup.txt /*popup_menu-shortcut-example*
popup_move() popup.txt /*popup_move()*
popup_notification() popup.txt /*popup_notification()*
+popup_setbuf() popup.txt /*popup_setbuf()*
popup_setoptions() popup.txt /*popup_setoptions()*
popup_settext() popup.txt /*popup_settext()*
popup_show() popup.txt /*popup_show()*
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 60d0d1e..a54a991 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -1319,6 +1319,7 @@
popup_move() change the position and size of a popup
popup_setoptions() override options of a popup
popup_settext() replace the popup buffer contents
+ popup_setbuf() set the popup buffer
popup_close() close one popup
popup_clear() close all popups
popup_filter_menu() select from a list of items
diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index 5b5bded..86dfe6d 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.1. Last change: 2024 Jun 17
+*version9.txt* For Vim version 9.1. Last change: 2024 Jun 18
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -41586,6 +41586,7 @@
|getregionpos()| get a list of positions for a region
|matchbufline()| all the matches of a pattern in a buffer
|matchstrlist()| all the matches of a pattern in a List of strings
+|popup_setbuf()| switch to a different buffer in a popup
Autocommands: ~