Mercurial > vim
comparison src/testdir/test_popupwin.vim @ 16837:18593056d8f1 v8.1.1420
patch 8.1.1420: popup window size only uses first line length
commit https://github.com/vim/vim/commit/88c4e1f06905983870175a473683e81312d14c64
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed May 29 23:14:28 2019 +0200
patch 8.1.1420: popup window size only uses first line length
Problem: Popup window size only uses first line length.
Solution: Use the longest line. (Ben Jackson, closes https://github.com/vim/vim/issues/4451) Also deal with
wrapping lines.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 29 May 2019 23:15:05 +0200 |
parents | 5cebaecad422 |
children | 032d5335987e |
comparison
equal
deleted
inserted
replaced
16836:237a080e55a3 | 16837:18593056d8f1 |
---|---|
174 call assert_equal(10, res.width) | 174 call assert_equal(10, res.width) |
175 call assert_equal(11, res.height) | 175 call assert_equal(11, res.height) |
176 | 176 |
177 call popup_close(winid) | 177 call popup_close(winid) |
178 endfunc | 178 endfunc |
179 | |
180 func Test_popup_width_longest() | |
181 let tests = [ | |
182 \ [['hello', 'this', 'window', 'displays', 'all of its text'], 15], | |
183 \ [['hello', 'this', 'window', 'all of its text', 'displays'], 15], | |
184 \ [['hello', 'this', 'all of its text', 'window', 'displays'], 15], | |
185 \ [['hello', 'all of its text', 'this', 'window', 'displays'], 15], | |
186 \ [['all of its text', 'hello', 'this', 'window', 'displays'], 15], | |
187 \ ] | |
188 | |
189 for test in tests | |
190 let winid = popup_create(test[0], {'line': 2, 'col': 3}) | |
191 redraw | |
192 let position = popup_getposition(winid) | |
193 call assert_equal(test[1], position.width) | |
194 call popup_close(winid) | |
195 endfor | |
196 endfunc | |
197 | |
198 func Test_popup_wraps() | |
199 let tests = [ | |
200 \ ['nowrap', 6, 1], | |
201 \ ['a line that wraps once', 12, 2], | |
202 \ ['a line that wraps two times', 12, 3], | |
203 \ ] | |
204 for test in tests | |
205 let winid = popup_create(test[0], | |
206 \ {'line': 2, 'col': 3, 'maxwidth': 12}) | |
207 redraw | |
208 let position = popup_getposition(winid) | |
209 call assert_equal(test[1], position.width) | |
210 call assert_equal(test[2], position.height) | |
211 | |
212 call popup_close(winid) | |
213 endfor | |
214 endfunc |