Mercurial > vim
diff src/testdir/test_popupwin.vim @ 17225:09fa437d33d8 v8.1.1612
patch 8.1.1612: cannot show an existing buffer in a popup window
commit https://github.com/vim/vim/commit/5b8cfedfbd19a71a30c73cf44b0aec3da7fc1a24
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Jun 30 22:16:10 2019 +0200
patch 8.1.1612: cannot show an existing buffer in a popup window
Problem: Cannot show an existing buffer in a popup window.
Solution: Support buffer number argument in popup_create().
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 30 Jun 2019 22:30:05 +0200 |
parents | 5169811b3044 |
children | e9ebf3f27af6 |
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim +++ b/src/testdir/test_popupwin.vim @@ -559,7 +559,7 @@ func Test_popup_valid_arguments() endfunc func Test_popup_invalid_arguments() - call assert_fails('call popup_create(666, {})', 'E714:') + call assert_fails('call popup_create(666, {})', 'E86:') call popup_clear() call assert_fails('call popup_create("text", "none")', 'E715:') call popup_clear() @@ -1654,3 +1654,18 @@ func Test_popupwin_garbage_collect() call popup_close(winid) delfunc MyPopupFilter endfunc + +func Test_popupwin_with_buffer() + call writefile(['some text', 'in a buffer'], 'XsomeFile') + let buf = bufadd('XsomeFile') + call assert_equal(0, bufloaded(buf)) + let winid = popup_create(buf, {}) + call assert_notequal(0, winid) + let pos = popup_getpos(winid) + call assert_equal(2, pos.height) + call assert_equal(1, bufloaded(buf)) + call popup_close(winid) + call assert_equal({}, popup_getpos(winid)) + call assert_equal(1, bufloaded(buf)) + exe 'bwipe! ' .. buf +endfunc