patch 8.1.1443: popup window padding and border not implemented yet
Problem: Popup window padding and border not implemented yet.
Solution: Implement padding and border. Add core position and size to
popup_getpos().
diff --git a/src/testdir/dumps/Test_popupwin_20.dump b/src/testdir/dumps/Test_popupwin_20.dump
new file mode 100644
index 0000000..237b1de
--- /dev/null
+++ b/src/testdir/dumps/Test_popupwin_20.dump
@@ -0,0 +1,15 @@
+>1+0&#ffffff0| @73
+|2| |++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@18
+|3| ||+0#0000001#ffd7ff255|h|e|l@1|o| |b|o|r|d|e|r||| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255|h|e|l@1|o| |p|a|d@1|i|n|g| | +0#0000000#ffffff0@4||+0#0000001#ffd7ff255| @11||| +0#0000000#ffffff0@18
+|4| |++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@5| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4||+0#0000001#ffd7ff255| |h|e|l@1|o| |b|o|t|h| ||| +0#0000000#ffffff0@18
+|5| @40||+0#0000001#ffd7ff255| @11||| +0#0000000#ffffff0@18
+|6| |++0#0000001#ffd7ff255|-@8| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@4|++0#0000001#ffd7ff255|-@11|+| +0#0000000#ffffff0@18
+|7| ||+0#0000001#ffd7ff255|b|o|r|d|e|r| |T|L| +0#0000000#ffffff0@9| +0#0000001#ffd7ff255@3|p|a|d@1|i|n|g|s| @2| +0#0000000#ffffff0@37
+|8| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37
+|9| @20| +0#0000001#ffd7ff255@14| +0#0000000#ffffff0@37
+|1|0| @72
+|1@1| @72
+|1|2| @72
+|1|3| @72
+|1|4| @72
+@57|1|,|1| @10|T|o|p|
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index b9d6a06..795a1be 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -56,6 +56,54 @@
call delete('XtestPopup')
endfunc
+func Test_popup_with_border_and_padding()
+ if !CanRunVimInTerminal()
+ return
+ endif
+ call writefile([
+ \ "call setline(1, range(1, 100))",
+ \ "call popup_create('hello border', {'line': 2, 'col': 3, 'border': []})",
+ \ "call popup_create('hello padding', {'line': 2, 'col': 23, 'padding': []})",
+ \ "call popup_create('hello both', {'line': 2, 'col': 43, 'border': [], 'padding': []})",
+ \ "call popup_create('border TL', {'line': 6, 'col': 3, 'border': [1, 0, 0, 4]})",
+ \ "call popup_create('paddings', {'line': 6, 'col': 23, 'padding': [1, 3, 2, 4]})",
+ \], 'XtestPopupBorder')
+ let buf = RunVimInTerminal('-S XtestPopupBorder', {'rows': 15})
+ call VerifyScreenDump(buf, 'Test_popupwin_20', {})
+
+ " clean up
+ call StopVimInTerminal(buf)
+ call delete('XtestPopupBorder')
+
+ let with_border_or_padding = {
+ \ 'line': 2,
+ \ 'core_line': 3,
+ \ 'col': 3,
+ \ 'core_col': 4,
+ \ 'width': 14,
+ \ 'core_width': 12,
+ \ 'height': 3,
+ \ 'core_height': 1,
+ \ 'visible': 1}
+ let winid = popup_create('hello border', {'line': 2, 'col': 3, 'border': []})",
+ call assert_equal(with_border_or_padding, popup_getpos(winid))
+
+ let winid = popup_create('hello paddng', {'line': 2, 'col': 3, 'padding': []})
+ call assert_equal(with_border_or_padding, popup_getpos(winid))
+
+ let winid = popup_create('hello both', {'line': 3, 'col': 8, 'border': [], 'padding': []})
+ call assert_equal({
+ \ 'line': 3,
+ \ 'core_line': 5,
+ \ 'col': 8,
+ \ 'core_col': 10,
+ \ 'width': 14,
+ \ 'core_width': 10,
+ \ 'height': 5,
+ \ 'core_height': 1,
+ \ 'visible': 1}, popup_getpos(winid))
+endfunc
+
func Test_popup_with_syntax_win_execute()
if !CanRunVimInTerminal()
return