diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-15 14:55:33 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-15 14:55:33 +0100 |
commit | 5e5a98d7de41457fabad4eb5af3d54cc93f05d0a (patch) | |
tree | ef4b1f570cf5db8ac883a41dff2f9b49609fc4e1 | |
parent | f9cb05c14753d984f002c0c090688f8510147e6b (diff) | |
download | vim-git-5e5a98d7de41457fabad4eb5af3d54cc93f05d0a.tar.gz |
patch 8.2.0011: screen updating wrong when opeing preview windowv8.2.0011
Problem: Screen updating wrong when opeing preview window.
Solution: Redraw the window when the preview window opens.
-rw-r--r-- | src/popupmenu.c | 9 | ||||
-rw-r--r-- | src/testdir/dumps/Test_pum_with_preview_win.dump | 12 | ||||
-rw-r--r-- | src/testdir/test_ins_complete.vim | 27 | ||||
-rw-r--r-- | src/version.c | 2 |
4 files changed, 46 insertions, 4 deletions
diff --git a/src/popupmenu.c b/src/popupmenu.c index ab2ce555b..cccde47ad 100644 --- a/src/popupmenu.c +++ b/src/popupmenu.c @@ -913,7 +913,7 @@ pum_set_selected(int n, int repeat UNUSED) // When the preview window was resized we need to // update the view on the buffer. Only go back to // the window when needed, otherwise it will always be - // redraw. + // redrawn. if (resized && win_valid(curwin_save)) { ++no_u_sync; @@ -926,8 +926,9 @@ pum_set_selected(int n, int repeat UNUSED) // Enable updating the status lines. pum_pretend_not_visible = TRUE; // But don't draw text at the new popup menu position, - // it causes flicker. - pum_will_redraw = TRUE; + // it causes flicker. When resizing we need to draw + // anyway, the position may change later. + pum_will_redraw = !resized; update_screen(0); pum_pretend_not_visible = FALSE; pum_will_redraw = FALSE; @@ -949,7 +950,7 @@ pum_set_selected(int n, int repeat UNUSED) // May need to update the screen again when there are // autocommands involved. pum_pretend_not_visible = TRUE; - pum_will_redraw = TRUE; + pum_will_redraw = !resized; update_screen(0); pum_pretend_not_visible = FALSE; pum_will_redraw = FALSE; diff --git a/src/testdir/dumps/Test_pum_with_preview_win.dump b/src/testdir/dumps/Test_pum_with_preview_win.dump new file mode 100644 index 000000000..ad0df7814 --- /dev/null +++ b/src/testdir/dumps/Test_pum_with_preview_win.dump @@ -0,0 +1,12 @@ +|1+0&#ffffff0|i|n|f|o| @69 +|~+0#4040ff13&| @73 +|~| @73 +|[+1#0000000&|S|c|r|a|t|c|h|]| |[|P|r|e|v|i|e|w|]| @37|1|,|1| @11|A|l@1 +|o+0&&|n|e> @71 +|o+0#0000001#e0e0e08|n|e| @11| +0#4040ff13#ffffff0@59 +|t+0#0000001#ffd7ff255|w|o| @11| +0#4040ff13#ffffff0@59 +|t+0#0000001#ffd7ff255|h|r|e@1| @9| +0#4040ff13#ffffff0@59 +|~| @73 +|~| @73 +|[+3#0000000&|N|o| |N|a|m|e|]| |[|+|]| @43|1|,|1| @11|A|l@1 +|-+2&&@1| |O|m|n|i| |c|o|m|p|l|e|t|i|o|n| |(|^|O|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |3| +0#0000000&@34 diff --git a/src/testdir/test_ins_complete.vim b/src/testdir/test_ins_complete.vim index ad6294480..95954f536 100644 --- a/src/testdir/test_ins_complete.vim +++ b/src/testdir/test_ins_complete.vim @@ -404,3 +404,30 @@ func Test_pum_with_folds_two_tabs() call StopVimInTerminal(buf) call delete('Xpumscript') endfunc + +func Test_pum_with_preview_win() + CheckScreendump + + let lines =<< trim END + funct Omni_test(findstart, base) + if a:findstart + return col(".") - 1 + endif + return [#{word: "one", info: "1info"}, #{word: "two", info: "2info"}, #{word: "three", info: "3info"}] + endfunc + set omnifunc=Omni_test + set completeopt+=longest + END + + call writefile(lines, 'Xpreviewscript') + let buf = RunVimInTerminal('-S Xpreviewscript', #{rows: 12}) + call term_wait(buf, 100) + call term_sendkeys(buf, "Gi\<C-X>\<C-O>") + call term_wait(buf, 100) + call term_sendkeys(buf, "\<C-N>") + call VerifyScreenDump(buf, 'Test_pum_with_preview_win', {}) + + call term_sendkeys(buf, "\<Esc>") + call StopVimInTerminal(buf) + call delete('Xpreviewscript') +endfunc diff --git a/src/version.c b/src/version.c index eb031ab7f..c4c583ab6 100644 --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 11, +/**/ 10, /**/ 9, |