diff options
-rw-r--r-- | src/nvim/drawscreen.c | 7 | ||||
-rw-r--r-- | test/functional/plugin/lsp/utils_spec.lua | 18 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/nvim/drawscreen.c b/src/nvim/drawscreen.c index a645dced40..c17bc2d999 100644 --- a/src/nvim/drawscreen.c +++ b/src/nvim/drawscreen.c @@ -2319,6 +2319,13 @@ static void win_update(win_T *wp) wp->w_lines[idx].wl_lastlnum = lnum + foldinfo.fi_lines; did_update = DID_FOLD; } + + // Adjust "wl_lastlnum" for concealed lines below the last line in the window. + while (row == wp->w_grid.rows + && decor_conceal_line(wp, wp->w_lines[idx].wl_lastlnum, false)) { + wp->w_lines[idx].wl_lastlnum++; + hasFolding(wp, wp->w_lines[idx].wl_lastlnum, NULL, &wp->w_lines[idx].wl_lastlnum); + } } wp->w_lines[idx].wl_lnum = lnum; diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua index 75cc69bed4..683e2a7641 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -382,6 +382,24 @@ describe('vim.lsp.util', function() {1:~ }|*9 | ]]) + -- This tests the valid winline code path (why doesn't the above?). + exec_lua([[ + vim.cmd.only() + vim.lsp.util.open_floating_preview({ 'foo', '```lua', 'local bar', '```' }, 'markdown', { + border = 'single', + focus = false, + }) + ]]) + feed('<C-W>wG') + screen:expect([[ + | + ┌─────────┐{1: }| + │{4:foo }│{1: }| + │{100:^local}{101: }{102:bar}│{1: }| + └─────────┘{1: }| + {1:~ }|*8 + | + ]]) end) it('open_floating_preview height does not exceed max_height', function() |