From 0786ebe305f882fe6d9cd8771fdc821dcaad46a6 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Mon, 25 Apr 2016 20:55:37 +0200 Subject: [PATCH 1/2] vim-patch:7.4.882 Problem: When leaving the command line window with CTRL-C while a completion menu is displayed the menu isn't removed. Solution: Force a screen update. (Hirohito Higashi) https://github.com/vim/vim/commit/5f1fea28f5bc573e2430773c49e95ae1f9cc2a25 Applied manually. --- src/nvim/edit.c | 6 ++++++ src/nvim/version.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 26966b35c1..df5d5bb0fd 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -3306,6 +3306,12 @@ static bool ins_compl_prep(int c) showmode(); } + // Avoid the popup menu remains displayed when leaving the + // command line window. + if (c == Ctrl_C && cmdwin_type != 0) { + update_screen(0); + } + /* * Indent now if a key was typed that is in 'cinkeys'. */ diff --git a/src/nvim/version.c b/src/nvim/version.c index b9e97f205e..5347a05c0b 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -796,7 +796,7 @@ static int included_patches[] = { 885, // 884 NA 883, - // 882, + 882, 881, // 880 NA 879, From fd3088b425b8c1f4f41eb715201e429ddd37af32 Mon Sep 17 00:00:00 2001 From: KillTheMule Date: Mon, 25 Apr 2016 22:17:54 +0200 Subject: [PATCH 2/2] Even though the patch is not needed for neovim, add a test for the bugfix --- test/functional/viml/completion_spec.lua | 48 ++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua index 322d777ab6..10941490d7 100644 --- a/test/functional/viml/completion_spec.lua +++ b/test/functional/viml/completion_spec.lua @@ -3,6 +3,7 @@ local helpers = require('test.functional.helpers') local Screen = require('test.functional.ui.screen') local clear, feed = helpers.clear, helpers.feed local eval, eq, neq = helpers.eval, helpers.eq, helpers.neq +local insert = helpers.insert local execute, source, expect = helpers.execute, helpers.source, helpers.expect describe('completion', function() @@ -714,6 +715,53 @@ describe('completion', function() {3:-- Keyword completion (^N^P) }{4:match 2 of 2} | ]]) end) + + describe('from the commandline window', function() + it('is cleared after CTRL-C', function () + feed('q:') + feed('ifoo faa fee f') + screen:expect([[ + | + {8:[No Name] }| + :foo faa fee f^ | + :~ | + :~ | + :~ | + {9:[Command Line] }| + {3:-- INSERT --} | + ]], {[3] = {bold = true}, + [4] = {bold = true, foreground = Screen.colors.SeaGreen}, + [8] = {reverse = true}, + [9] = {bold = true, reverse = true}}) + feed('') + screen:expect([[ + | + {8:[No Name] }| + :foo faa fee foo^ | + :~ {2: foo } | + :~ {1: faa } | + :~ {1: fee } | + {9:[Command Line] }| + {3:-- Keyword Local completion (^N^P) }{4:match 1 of 3} | + ]],{[1] = {background = Screen.colors.LightMagenta}, + [2] = {background = Screen.colors.Grey}, + [3] = {bold = true}, + [4] = {bold = true, foreground = Screen.colors.SeaGreen}, + [8] = {reverse = true}, + [9] = {bold = true, reverse = true}}) + feed('') + screen:expect([[ + | + {8:[No Name] }| + :foo faa fee foo | + :~ | + :~ | + :~ | + {9:[Command Line] }| + :foo faa fee foo^ | + ]], {[8] = {reverse = true}, [9] = {bold = true, reverse = true}}) + end) + end) end)