Mercurial > vim
comparison src/testdir/test_popupwin.vim @ 18542:244b336b94ce v8.1.2265
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Commit: https://github.com/vim/vim/commit/638a4a7508082f8700b135953e4f9465f675a0f5
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Nov 6 19:25:22 2019 +0100
patch 8.1.2265: when popup with "botleft" does not fit it flips incorrectly
Problem: When popup with "botleft" does not fit it flips incorrectly.
Solution: Only flip when there is more space on the other side. Add the
"posinvert" option to disable flipping and do it in both
directions if enabled. (closes #5151)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 06 Nov 2019 19:30:03 +0100 |
parents | e855058e0c23 |
children | a6dbbedddce1 |
comparison
equal
deleted
inserted
replaced
18541:cb6c4e282681 | 18542:244b336b94ce |
---|---|
319 call VerifyScreenDump(buf, 'Test_popupwin_corners', {}) | 319 call VerifyScreenDump(buf, 'Test_popupwin_corners', {}) |
320 | 320 |
321 " clean up | 321 " clean up |
322 call StopVimInTerminal(buf) | 322 call StopVimInTerminal(buf) |
323 call delete('XtestPopupCorners') | 323 call delete('XtestPopupCorners') |
324 endfunc | |
325 | |
326 func Test_popup_nospace() | |
327 CheckScreendump | |
328 | |
329 let lines =<< trim END | |
330 call setline(1, repeat([repeat('-', 60)], 15)) | |
331 set so=0 | |
332 | |
333 " cursor in a line in top half, using "botleft" with popup that | |
334 " does fit | |
335 normal 5G2|r@ | |
336 let winid1 = popup_create(['one', 'two'], #{ | |
337 \ line: 'cursor-1', | |
338 \ col: 'cursor', | |
339 \ pos: 'botleft', | |
340 \ border: [], | |
341 \ }) | |
342 " cursor in a line in top half, using "botleft" with popup that | |
343 " doesn't fit: gets truncated | |
344 normal 5G9|r# | |
345 let winid1 = popup_create(['one', 'two', 'tee'], #{ | |
346 \ line: 'cursor-1', | |
347 \ col: 'cursor', | |
348 \ pos: 'botleft', | |
349 \ posinvert: 0, | |
350 \ border: [], | |
351 \ }) | |
352 " cursor in a line in top half, using "botleft" with popup that | |
353 " doesn't fit and 'posinvert' set: flips to below. | |
354 normal 5G16|r% | |
355 let winid1 = popup_create(['one', 'two', 'tee'], #{ | |
356 \ line: 'cursor-1', | |
357 \ col: 'cursor', | |
358 \ pos: 'botleft', | |
359 \ border: [], | |
360 \ }) | |
361 " cursor in a line in bottom half, using "botleft" with popup that | |
362 " doesn't fit: does not flip. | |
363 normal 8G23|r* | |
364 let winid1 = popup_create(['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff'], #{ | |
365 \ line: 'cursor-1', | |
366 \ col: 'cursor', | |
367 \ pos: 'botleft', | |
368 \ border: [], | |
369 \ }) | |
370 | |
371 " cursor in a line in bottom half, using "topleft" with popup that | |
372 " does fit | |
373 normal 8G30|r@ | |
374 let winid1 = popup_create(['one', 'two'], #{ | |
375 \ line: 'cursor+1', | |
376 \ col: 'cursor', | |
377 \ pos: 'topleft', | |
378 \ border: [], | |
379 \ }) | |
380 " cursor in a line in top half, using "topleft" with popup that | |
381 " doesn't fit: truncated | |
382 normal 8G37|r# | |
383 let winid1 = popup_create(['one', 'two', 'tee'], #{ | |
384 \ line: 'cursor+1', | |
385 \ col: 'cursor', | |
386 \ pos: 'topleft', | |
387 \ posinvert: 0, | |
388 \ border: [], | |
389 \ }) | |
390 " cursor in a line in top half, using "topleft" with popup that | |
391 " doesn't fit and "posinvert" set: flips to below. | |
392 normal 8G44|r% | |
393 let winid1 = popup_create(['one', 'two', 'tee'], #{ | |
394 \ line: 'cursor+1', | |
395 \ col: 'cursor', | |
396 \ pos: 'topleft', | |
397 \ border: [], | |
398 \ }) | |
399 " cursor in a line in top half, using "topleft" with popup that | |
400 " doesn't fit: does not flip. | |
401 normal 5G51|r* | |
402 let winid1 = popup_create(['aaa', 'bbb', 'ccc', 'ddd', 'eee', 'fff'], #{ | |
403 \ line: 'cursor+1', | |
404 \ col: 'cursor', | |
405 \ pos: 'topleft', | |
406 \ border: [], | |
407 \ }) | |
408 END | |
409 call writefile(lines, 'XtestPopupNospace') | |
410 let buf = RunVimInTerminal('-S XtestPopupNospace', #{rows: 12}) | |
411 call VerifyScreenDump(buf, 'Test_popupwin_nospace', {}) | |
412 | |
413 " clean up | |
414 call StopVimInTerminal(buf) | |
415 call delete('XtestPopupNospace') | |
324 endfunc | 416 endfunc |
325 | 417 |
326 func Test_popup_firstline() | 418 func Test_popup_firstline() |
327 CheckScreendump | 419 CheckScreendump |
328 | 420 |
584 \ 'some text', | 676 \ 'some text', |
585 \ 'another line', | 677 \ 'another line', |
586 \], #{ | 678 \], #{ |
587 \ line: 1, | 679 \ line: 1, |
588 \ col: 10, | 680 \ col: 10, |
681 \ posinvert: 0, | |
589 \ wrap: 0, | 682 \ wrap: 0, |
590 \ fixed: 1, | 683 \ fixed: 1, |
591 \ zindex: 90, | 684 \ zindex: 90, |
592 \ padding: [], | 685 \ padding: [], |
593 \ highlight: 'PopupColor', | 686 \ highlight: 'PopupColor', |
602 let winidb = popup_create([ | 695 let winidb = popup_create([ |
603 \ 'just one line', | 696 \ 'just one line', |
604 \], #{ | 697 \], #{ |
605 \ line: 7, | 698 \ line: 7, |
606 \ col: 10, | 699 \ col: 10, |
700 \ posinvert: 0, | |
607 \ wrap: 0, | 701 \ wrap: 0, |
608 \ fixed: 1, | 702 \ fixed: 1, |
609 \ close: 'button', | 703 \ close: 'button', |
610 \ zindex: 90, | 704 \ zindex: 90, |
611 \ padding: [], | 705 \ padding: [], |