aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/ex_getln.c1
-rw-r--r--src/nvim/ui_compositor.c5
-rw-r--r--test/functional/ui/cmdline_spec.lua39
-rw-r--r--test/functional/ui/float_spec.lua45
-rw-r--r--test/functional/ui/screen.lua8
5 files changed, 91 insertions, 7 deletions
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 479d195966..1c1bfcad31 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -1978,6 +1978,7 @@ static int command_line_changed(CommandLineState *s)
static void abandon_cmdline(void)
{
XFREE_CLEAR(ccline.cmdbuff);
+ ccline.redraw_state = kCmdRedrawNone;
if (msg_scrolled == 0) {
compute_cmdrow();
}
diff --git a/src/nvim/ui_compositor.c b/src/nvim/ui_compositor.c
index 0c3e771eb8..d12a411019 100644
--- a/src/nvim/ui_compositor.c
+++ b/src/nvim/ui_compositor.c
@@ -329,7 +329,7 @@ static void compose_line(Integer row, Integer startcol, Integer endcol,
memcpy(linebuf+(col-startcol), grid->chars+off, n * sizeof(*linebuf));
memcpy(attrbuf+(col-startcol), grid->attrs+off, n * sizeof(*attrbuf));
- // 'pumblend'
+ // 'pumblend' and 'winblend'
if (grid->blending) {
for (int i = col-(int)startcol; i < until-startcol; i++) {
bool thru = strequal((char *)linebuf[i], " "); // negative space
@@ -467,7 +467,8 @@ static void ui_comp_grid_scroll(UI *ui, Integer grid, Integer top,
bot += curgrid->comp_row;
left += curgrid->comp_col;
right += curgrid->comp_col;
- if (!msg_scroll_mode && kv_size(layers) > curgrid->comp_index+1) {
+ bool covered = kv_size(layers) > curgrid->comp_index+1 || curgrid->blending;
+ if (!msg_scroll_mode && covered) {
// TODO(bfredl):
// 1. check if rectangles actually overlap
// 2. calulate subareas that can scroll.
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index 915e7ae867..c63b726308 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -761,8 +761,42 @@ local function test_cmdline(linegrid)
}}, wildmenu_items=expected, wildmenu_pos=0}
end)
+ it("doesn't send invalid events when aborting mapping #10000", function()
+ command('cnoremap ab c')
+
+ feed(':xa')
+ screen:expect{grid=[[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]], cmdline={{
+ content = { { "x" } },
+ firstc = ":",
+ pos = 1,
+ special = { "a", false }
+ }}}
+
+ -- This used to send an invalid event where pos where larger than the total
+ -- lenght of content. Checked in _handle_cmdline_show.
+ feed('<esc>')
+ screen:expect([[
+ ^ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ end)
+
end
+-- the representation of cmdline and cmdline_block contents changed with ext_linegrid
+-- (which uses indexed highlights) so make sure to test both
+describe('ui/ext_cmdline', function() test_cmdline(true) end)
+describe('ui/ext_cmdline (legacy highlights)', function() test_cmdline(false) end)
+
describe('cmdline redraw', function()
local screen
before_each(function()
@@ -813,8 +847,3 @@ describe('cmdline redraw', function()
]], unchanged=true}
end)
end)
-
--- the representation of cmdline and cmdline_block contents changed with ext_linegrid
--- (which uses indexed highlights) so make sure to test both
-describe('ui/ext_cmdline', function() test_cmdline(true) end)
-describe('ui/ext_cmdline (legacy highlights)', function() test_cmdline(false) end)
diff --git a/test/functional/ui/float_spec.lua b/test/functional/ui/float_spec.lua
index 3c7418167c..41ba542899 100644
--- a/test/functional/ui/float_spec.lua
+++ b/test/functional/ui/float_spec.lua
@@ -3774,6 +3774,8 @@ describe('floating windows', function()
[4] = {foreground = Screen.colors.Red, background = Screen.colors.LightMagenta},
[5] = {foreground = tonumber('0x990000'), background = tonumber('0xfff1ff')},
[6] = {foreground = tonumber('0x332533'), background = tonumber('0xfff1ff')},
+ [7] = {background = tonumber('0xffcfff'), bold = true, foreground = tonumber('0x0000d8')},
+ [8] = {background = Screen.colors.LightMagenta, bold = true, foreground = Screen.colors.Blue1}
})
insert([[
Lorem ipsum dolor sit amet, consectetur
@@ -3953,6 +3955,49 @@ describe('floating windows', function()
|
]])
end
+
+ -- Test scrolling by mouse
+ if multigrid then
+ meths.input_mouse('wheel', 'down', '', 4, 2, 2)
+ screen:expect{grid=[[
+ ## grid 1
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ [2:--------------------------------------------------]|
+ |
+ ## grid 2
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea commodo consequat. Duis aute irure dolor in |
+ reprehenderit in voluptate velit esse cillum |
+ dolore eu fugiat nulla pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ ## grid 4
+ {4:popup text}{1: }|
+ {8:~ }|
+ {8:~ }|
+ ]], float_pos={[4] = {{id = 1002}, "NW", 1, 2, 5, true}}}
+ else
+ meths.input_mouse('wheel', 'down', '', 0, 4, 7)
+ screen:expect([[
+ Ut enim ad minim veniam, quis nostrud |
+ exercitation ullamco laboris nisi ut aliquip ex |
+ ea co{5:popup}{6: con}{5:text}{3:at}. Duis aute irure dolor in |
+ repre{7:~}{3:enderit in vol}uptate velit esse cillum |
+ dolor{7:~}{3: eu fugiat nul}la pariatur. Excepteur sint |
+ occaecat cupidatat non proident, sunt in culpa |
+ qui officia deserunt mollit anim id est |
+ laborum^. |
+ |
+ ]])
+ end
end)
end
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 044e4cc39c..0367e85028 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -946,6 +946,14 @@ function Screen:_handle_cmdline_show(content, pos, firstc, prompt, indent, level
if firstc == '' then firstc = nil end
if prompt == '' then prompt = nil end
if indent == 0 then indent = nil end
+
+ -- check position is valid #10000
+ local len = 0
+ for _, chunk in ipairs(content) do
+ len = len + string.len(chunk[2])
+ end
+ assert(pos <= len)
+
self.cmdline[level] = {content=content, pos=pos, firstc=firstc,
prompt=prompt, indent=indent}
end