diff 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
line wrap: on
line diff
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1814,15 +1814,25 @@ func Test_popupwin_with_buffer()
   call writefile(['some text', 'in a buffer'], 'XsomeFile')
   let buf = bufadd('XsomeFile')
   call assert_equal(0, bufloaded(buf))
+
+  setlocal number
+  call setbufvar(buf, "&wrapmargin", 13)
+
   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))
+
+  " window-local option is set to default, buffer-local is not
+  call assert_equal(0, getwinvar(winid, '&number'))
+  call assert_equal(13, getbufvar(buf, '&wrapmargin'))
+
   call popup_close(winid)
   call assert_equal({}, popup_getpos(winid))
   call assert_equal(1, bufloaded(buf))
   exe 'bwipe! ' .. buf
+  setlocal nonumber
 
   edit test_popupwin.vim
   let winid = popup_create(bufnr(''), {})