File tree 3 files changed +29
-0
lines changed
3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,17 @@ function M.setup()
51
51
end
52
52
end
53
53
54
+ function M .scroll (delta )
55
+ for _ , kind in ipairs ({ M .kinds .hover , M .kinds .signature }) do
56
+ local message = M .get (kind )
57
+ local win = message :win ()
58
+ if win then
59
+ Util .nui .scroll (win , delta )
60
+ return
61
+ end
62
+ end
63
+ end
64
+
54
65
--- @param message NoiceMessage
55
66
function M .augroup (message )
56
67
return " noice_lsp_" .. message .id
Original file line number Diff line number Diff line change @@ -235,4 +235,20 @@ function M.anchor(width, height)
235
235
return anchor
236
236
end
237
237
238
+ function M .scroll (win , delta )
239
+ local info = vim .fn .getwininfo (win )[1 ] or {}
240
+ local top = info .topline or 1
241
+ local buf = vim .api .nvim_win_get_buf (win )
242
+ top = top + delta
243
+ top = math.max (top , 1 )
244
+ top = math.min (top , M .win_buf_height (win ) - info .height + 1 )
245
+
246
+ vim .defer_fn (function ()
247
+ vim .api .nvim_buf_call (buf , function ()
248
+ vim .api .nvim_command (" normal! " .. top .. " zt" )
249
+ vim .cmd ([[ do WinScrolled]] )
250
+ end )
251
+ end , 0 )
252
+ end
253
+
238
254
return M
Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ function NuiView:update_options()
39
39
},
40
40
win_options = {
41
41
foldenable = false ,
42
+ scrolloff = 0 ,
43
+ sidescrolloff = 0 ,
42
44
},
43
45
}, self ._opts , self :get_layout ())
44
46
You can’t perform that action at this time.
0 commit comments