comparison src/testdir/test_popupwin.vim @ 17845:b6acc24df7de v8.1.1919

patch 8.1.1919: using window options when passing a buffer to popup_create() Commit: https://github.com/vim/vim/commit/4645104be4c521dfdd43621c19e96bda3cac7be2 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Aug 24 15:50:46 2019 +0200 patch 8.1.1919: using window options when passing a buffer to popup_create() Problem: Using current window option values when passing a buffer to popup_create(). Solution: Clear the window-local options. (closes #4857)
author Bram Moolenaar <Bram@vim.org>
date Sat, 24 Aug 2019 16:00:04 +0200
parents 9513821d9d8f
children bdddd215bf09
comparison
equal deleted inserted replaced
17844:168181338e11 17845:b6acc24df7de
1812 1812
1813 func Test_popupwin_with_buffer() 1813 func Test_popupwin_with_buffer()
1814 call writefile(['some text', 'in a buffer'], 'XsomeFile') 1814 call writefile(['some text', 'in a buffer'], 'XsomeFile')
1815 let buf = bufadd('XsomeFile') 1815 let buf = bufadd('XsomeFile')
1816 call assert_equal(0, bufloaded(buf)) 1816 call assert_equal(0, bufloaded(buf))
1817
1818 setlocal number
1819 call setbufvar(buf, "&wrapmargin", 13)
1820
1817 let winid = popup_create(buf, {}) 1821 let winid = popup_create(buf, {})
1818 call assert_notequal(0, winid) 1822 call assert_notequal(0, winid)
1819 let pos = popup_getpos(winid) 1823 let pos = popup_getpos(winid)
1820 call assert_equal(2, pos.height) 1824 call assert_equal(2, pos.height)
1821 call assert_equal(1, bufloaded(buf)) 1825 call assert_equal(1, bufloaded(buf))
1826
1827 " window-local option is set to default, buffer-local is not
1828 call assert_equal(0, getwinvar(winid, '&number'))
1829 call assert_equal(13, getbufvar(buf, '&wrapmargin'))
1830
1822 call popup_close(winid) 1831 call popup_close(winid)
1823 call assert_equal({}, popup_getpos(winid)) 1832 call assert_equal({}, popup_getpos(winid))
1824 call assert_equal(1, bufloaded(buf)) 1833 call assert_equal(1, bufloaded(buf))
1825 exe 'bwipe! ' .. buf 1834 exe 'bwipe! ' .. buf
1835 setlocal nonumber
1826 1836
1827 edit test_popupwin.vim 1837 edit test_popupwin.vim
1828 let winid = popup_create(bufnr(''), {}) 1838 let winid = popup_create(bufnr(''), {})
1829 redraw 1839 redraw
1830 call popup_close(winid) 1840 call popup_close(winid)