summaryrefslogtreecommitdiff
path: root/lua/telescope
diff options
context:
space:
mode:
authorJonas Strittmatter <40792180+smjonas@users.noreply.github.com>2022-09-17 10:15:36 +0200
committerGitHub <noreply@github.com>2022-09-17 10:15:36 +0200
commit30e2dc5232d0dd63709ef8b44a5d6184005e8602 (patch)
tree0022a1bac1e911e34a42bcba4b9ef96c48e596a6 /lua/telescope
parent4a43d13c953596503ff37fbc0cc80e68099c5c5c (diff)
fix: check for window before scrolling previewer (#2163)
This avoids an error when scrolling the preview window but the window is not visible (e.g. due to a screen resize).
Diffstat (limited to 'lua/telescope')
-rw-r--r--lua/telescope/actions/set.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/lua/telescope/actions/set.lua b/lua/telescope/actions/set.lua
index 7861bb2..11d379b 100644
--- a/lua/telescope/actions/set.lua
+++ b/lua/telescope/actions/set.lua
@@ -185,13 +185,13 @@ end
-- Valid directions include: "1", "-1"
action_set.scroll_previewer = function(prompt_bufnr, direction)
local previewer = action_state.get_current_picker(prompt_bufnr).previewer
+ local status = state.get_status(prompt_bufnr)
- -- Check if we actually have a previewer
- if type(previewer) ~= "table" or previewer.scroll_fn == nil then
+ -- Check if we actually have a previewer and a preview window
+ if type(previewer) ~= "table" or previewer.scroll_fn == nil or status.preview_win == nil then
return
end
- local status = state.get_status(prompt_bufnr)
local default_speed = vim.api.nvim_win_get_height(status.preview_win) / 2
local speed = status.picker.layout_config.scroll_speed or default_speed