compositor: handle scrolling of blended window

This commit is contained in:
Björn Linse 2019-06-26 08:29:06 +02:00
parent 10c983fabe
commit 2a2d288228
2 changed files with 48 additions and 2 deletions

View File

@ -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.

View File

@ -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