diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-08-03 00:41:52 +0200 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2017-08-05 21:32:34 +0200 |
commit | c6954437277175c9e2b8eb7e7e753314725aef8b (patch) | |
tree | 7699583b08d67bb56c057186857aac50b9e4bc84 | |
parent | 55c0401dfd137a5e173d8551f763cb4c6fed56e1 (diff) | |
download | rneovim-c6954437277175c9e2b8eb7e7e753314725aef8b.tar.gz rneovim-c6954437277175c9e2b8eb7e7e753314725aef8b.tar.bz2 rneovim-c6954437277175c9e2b8eb7e7e753314725aef8b.zip |
win_redr_status(): skip if wildmenu is showing
This might be too coarse, but it passes all tests ...
A more nuanced approach might be: only skip the windows whose
statuslines are overwritten by the wildmenu.
Closes #2255
Closes #7108
vim-patch:8.0.0710 N/A because of the changes in this commit.
-rw-r--r-- | src/nvim/screen.c | 36 | ||||
-rw-r--r-- | src/nvim/version.c | 223 | ||||
-rw-r--r-- | test/functional/ui/wildmode_spec.lua | 150 |
3 files changed, 354 insertions, 55 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index bcc996679b..cd4f4de40f 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -86,6 +86,7 @@ #include <stdbool.h> #include <string.h> +#include "nvim/log.h" #include "nvim/vim.h" #include "nvim/ascii.h" #include "nvim/arabic.h" @@ -4874,11 +4875,14 @@ void win_redr_status(win_T *wp) int this_ru_col; static int busy = FALSE; - /* It's possible to get here recursively when 'statusline' (indirectly) - * invokes ":redrawstatus". Simply ignore the call then. */ - if (busy) + // May get here recursively when 'statusline' (indirectly) + // invokes ":redrawstatus". Simply ignore the call then. + if (busy + // Also ignore if wildmenu is showing. + || (wild_menu_showing != 0 && !ui_is_external(kUIWildmenu))) { return; - busy = TRUE; + } + busy = true; wp->w_redr_status = FALSE; if (wp->w_status_height == 0) { @@ -6441,13 +6445,11 @@ void setcursor(void) } } -/* - * insert 'line_count' lines at 'row' in window 'wp' - * if 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated. - * if 'mayclear' is TRUE the screen will be cleared if it is faster than - * scrolling. - * Returns FAIL if the lines are not inserted, OK for success. - */ +/// Insert 'line_count' lines at 'row' in window 'wp'. +/// If 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated. +/// If 'mayclear' is TRUE the screen will be cleared if it is faster than +/// scrolling. +/// Returns FAIL if the lines are not inserted, OK for success. int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) { int did_delete; @@ -6510,13 +6512,11 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) return OK; } -/* - * delete "line_count" window lines at "row" in window "wp" - * If "invalid" is TRUE curwin->w_lines[] is invalidated. - * If "mayclear" is TRUE the screen will be cleared if it is faster than - * scrolling - * Return OK for success, FAIL if the lines are not deleted. - */ +/// Delete "line_count" window lines at "row" in window "wp". +/// If "invalid" is TRUE curwin->w_lines[] is invalidated. +/// If "mayclear" is TRUE the screen will be cleared if it is faster than +/// scrolling +/// Return OK for success, FAIL if the lines are not deleted. int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear) { int retval; diff --git a/src/nvim/version.c b/src/nvim/version.c index f2b56e0108..c443b63bb0 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -77,6 +77,229 @@ static char *features[] = { // clang-format off static const int included_patches[] = { + // 875, + // 874, + // 873, + // 872, + // 871, + // 870, + // 869, + // 868, + // 867, + // 866, + // 865, + // 864, + // 863, + // 862, + // 861, + // 860, + // 859, + // 858, + // 857, + // 856, + // 855, + // 854, + // 853, + // 852, + // 851, + // 850, + // 849, + // 848, + // 847, + // 846, + // 845, + // 844, + // 843, + // 842, + // 841, + // 840, + // 839, + // 838, + // 837, + // 836, + // 835, + // 834, + // 833, + // 832, + // 831, + // 830, + // 829, + // 828, + // 827, + // 826, + // 825, + // 824, + // 823, + // 822, + // 821, + // 820, + // 819, + // 818, + // 817, + // 816, + // 815, + // 814, + // 813, + // 812, + // 811, + // 810, + // 809, + // 808, + // 807, + // 806, + // 805, + // 804, + // 803, + // 802, + // 801, + // 800, + // 799, + // 798, + // 797, + // 796, + // 795, + // 794, + // 793, + // 792, + // 791, + // 790, + // 789, + // 788, + // 787, + // 786, + // 785, + // 784, + // 783, + // 782, + // 781, + // 780, + // 779, + // 778, + // 777, + // 776, + // 775, + // 774, + // 773, + // 772, + // 771, + // 770, + // 769, + // 768, + // 767, + // 766, + // 765, + // 764, + // 763, + // 762, + // 761, + // 760, + // 759, + // 758, + // 757, + // 756, + // 755, + // 754, + // 753, + // 752, + // 751, + // 750, + // 749, + // 748, + // 747, + // 746, + // 745, + // 744, + // 743, + // 742, + // 741, + // 740, + // 739, + // 738, + // 737, + // 736, + // 735, + // 734, + // 733, + // 732, + // 731, + // 730, + // 729, + // 728, + // 727, + // 726, + // 725, + // 724, + // 723, + // 722, + // 721, + // 720, + // 719, + // 718, + // 717, + // 716, + // 715, + // 714, + // 713, + // 712, + // 711, + 710, + // 709, + // 708, + // 707, + // 706, + // 705, + // 704, + // 703, + // 702, + // 701, + // 700, + // 699, + // 698, + // 697, + // 696, + // 695, + // 694, + // 693, + // 692, + // 691, + // 690, + // 689, + // 688, + // 687, + // 686, + // 685, + // 684, + // 683, + // 682, + // 681, + // 680, + // 679, + // 678, + // 677, + // 676, + // 675, + // 674, + // 673, + // 672, + // 671, + // 670, + // 669, + // 668, + // 667, + // 666, + // 665, + // 664, + // 663, + // 662, + // 661, + // 660, + // 659, + // 658, + // 657, + // 656, + // 655, + // 654, + // 653, 652, // 651, // 650, diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua index 052cdd55a1..154f508924 100644 --- a/test/functional/ui/wildmode_spec.lua +++ b/test/functional/ui/wildmode_spec.lua @@ -1,57 +1,133 @@ local helpers = require('test.functional.helpers')(after_each) local Screen = require('test.functional.ui.screen') local clear, feed, command = helpers.clear, helpers.feed, helpers.command +local iswin, set_shell_powershell = helpers.iswin, helpers.set_shell_powershell +local nvim_dir = helpers.nvim_dir local funcs = helpers.funcs +local eq = helpers.eq +local eval = helpers.eval +local retry = helpers.retry -if helpers.pending_win32(pending) then return end - -describe("'wildmode'", function() +describe("'wildmenu'", function() local screen - before_each(function() clear() screen = Screen.new(25, 5) screen:attach() end) - after_each(function() screen:detach() end) - describe("'wildmenu'", function() - it(':sign <tab> shows wildmenu completions', function() - command('set wildmode=full') - command('set wildmenu') - feed(':sign <tab>') - screen:expect([[ - | - ~ | - ~ | - define jump list > | - :sign define^ | - ]]) - end) + it(':sign <tab> shows wildmenu completions', function() + command('set wildmode=full') + command('set wildmenu') + feed(':sign <tab>') + screen:expect([[ + | + ~ | + ~ | + define jump list > | + :sign define^ | + ]]) + end) + + it('does not crash after cycling back to original text', function() + command('set wildmode=full') + feed(':j<Tab><Tab><Tab>') + screen:expect([[ + | + ~ | + ~ | + join jumps | + :j^ | + ]]) + -- This would cause nvim to crash before #6650 + feed('<BS><Tab>') + screen:expect([[ + | + ~ | + ~ | + ! # & < = > @ > | + :!^ | + ]]) + end) + + it('is preserved during :terminal activity', function() + -- Because this test verifies a _lack_ of activity after screen:sleep(), we + -- must wait the full timeout. So make it reasonable. + screen.timeout = 1000 - it('does not crash after cycling back to original text', function() - command('set wildmode=full') - feed(':j<Tab><Tab><Tab>') - screen:expect([[ - | - ~ | - ~ | - join jumps | - :j^ | - ]]) - -- This would cause nvim to crash before #6650 - feed('<BS><Tab>') - screen:expect([[ - | - ~ | - ~ | - ! # & < = > @ > | - :!^ | - ]]) + command('set wildmenu wildmode=full') + command('set scrollback=4') + if iswin() then + if helpers.pending_win32(pending) then return end + -- feed([[:terminal 1,2,3,4,5 | foreach-object -process {echo $_; sleep 0.1}]]) + else + feed([[:terminal for i in $(seq 1 5000); do printf 'foo\nfoo\nfoo\n'; sleep 0.1; done<cr>]]) + end + screen:sleep(50) -- Allow some output. + feed([[<C-\><C-N>gg]]) + feed([[:sign <Tab>]]) -- Invoke wildmenu. + screen:sleep(50) -- Allow some output. + screen:expect([[ + foo | + foo | + foo | + define jump list > | + :sign define^ | + ]]) + end) + + it('ignores :redrawstatus called from a timer #7108', function() + -- Because this test verifies a _lack_ of activity after screen:sleep(), we + -- must wait the full timeout. So make it reasonable. + screen.timeout = 1000 + + command('set wildmenu wildmode=full') + command([[call timer_start(10, {->execute('redrawstatus')}, {'repeat':-1})]]) + feed([[<C-\><C-N>]]) + feed([[:sign <Tab>]]) -- Invoke wildmenu. + screen:sleep(30) -- Allow some timer activity. + screen:expect([[ + | + ~ | + ~ | + define jump list > | + :sign define^ | + ]]) + end) + + it('with laststatus=0, :vsplit, :term #2255', function() + -- Because this test verifies a _lack_ of activity after screen:sleep(), we + -- must wait the full timeout. So make it reasonable. + screen.timeout = 1000 + + if iswin() then + set_shell_powershell() + else + command('set shell=sh') + end + + command('set laststatus=0') + command('vsplit') + command('term') + + -- Check for a shell prompt to verify that the terminal loaded. + retry(nil, nil, function() + if iswin() then + eq('PS', eval("matchstr(join(getline(1, '$')), 'PS')")) + else + eq('$', eval([[matchstr(getline(1), '\$')]])) + end end) + + feed([[<C-\><C-N>]]) + feed([[:<Tab>]]) -- Invoke wildmenu. + screen:sleep(10) -- Flush + -- Check only the last 2 lines, because the shell output is + -- system-dependent. + screen:expect('! # & < = > @ > \n:!^', nil, nil, nil, true) end) end) |