Mercurial > vim
comparison src/testdir/test_popupwin.vim @ 22403:3351d2cd3f1f v8.2.1750
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Commit: https://github.com/vim/vim/commit/3697c9bbae755831d3cf2f11179aaff29e343f51
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 26 22:03:00 2020 +0200
patch 8.2.1750: popup_setoptions() setting firstline fails if cursorline set
Problem: Setting firstline with popup_setoptions() fails if cursorline is
set.
Solution: Use apply_options(). Update the popup before applying "zz".
(closes #7010)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 26 Sep 2020 22:15:04 +0200 |
parents | b2cb2a321af9 |
children | 909ce065e99a |
comparison
equal
deleted
inserted
replaced
22402:337df0dbfe0a | 22403:3351d2cd3f1f |
---|---|
1577 | 1577 |
1578 call VerifyScreenDump(buf, 'Test_popupwin_win_execute_cursorline', {}) | 1578 call VerifyScreenDump(buf, 'Test_popupwin_win_execute_cursorline', {}) |
1579 | 1579 |
1580 call StopVimInTerminal(buf) | 1580 call StopVimInTerminal(buf) |
1581 call delete('XtestPopupWinExecute') | 1581 call delete('XtestPopupWinExecute') |
1582 endfunc | |
1583 | |
1584 func Test_popup_set_firstline() | |
1585 CheckScreendump | |
1586 | |
1587 let lines =<< trim END | |
1588 let lines = range(1, 50)->map({_, v -> string(v)}) | |
1589 let g:id = popup_create(lines, #{ | |
1590 \ minwidth: 20, | |
1591 \ maxwidth: 20, | |
1592 \ minheight: &lines - 5, | |
1593 \ maxheight: &lines - 5, | |
1594 \ cursorline: 1, | |
1595 \ }) | |
1596 call popup_setoptions(g:id, #{firstline: 10}) | |
1597 redraw | |
1598 END | |
1599 call writefile(lines, 'XtestPopupWinSetFirstline') | |
1600 let buf = RunVimInTerminal('-S XtestPopupWinSetFirstline', #{rows: 16}) | |
1601 | |
1602 call VerifyScreenDump(buf, 'Test_popupwin_set_firstline_1', {}) | |
1603 | |
1604 call term_sendkeys(buf, ":call popup_setoptions(g:id, #{firstline: 5})\<CR>") | |
1605 call term_sendkeys(buf, ":\<CR>") | |
1606 call VerifyScreenDump(buf, 'Test_popupwin_set_firstline_2', {}) | |
1607 | |
1608 call StopVimInTerminal(buf) | |
1609 call delete('XtestPopupWinSetFirstline') | |
1582 endfunc | 1610 endfunc |
1583 | 1611 |
1584 " this tests that we don't get stuck with an error in "win_execute()" | 1612 " this tests that we don't get stuck with an error in "win_execute()" |
1585 func Test_popup_filter_win_execute_error() | 1613 func Test_popup_filter_win_execute_error() |
1586 CheckScreendump | 1614 CheckScreendump |