Skip to content

fix(telescope): resolve preview window via status.layout.preview.winid#353

Open
bassemkaroui wants to merge 1 commit intorcarriga:masterfrom
bassemkaroui:fix/telescope-preview-winid
Open

fix(telescope): resolve preview window via status.layout.preview.winid#353
bassemkaroui wants to merge 1 commit intorcarriga:masterfrom
bassemkaroui:fix/telescope-preview-winid

Conversation

@bassemkaroui
Copy link
Copy Markdown

Problem

Navigating :Telescope notify on a current telescope.nvim build raises:

Invalid 'window': Expected Lua number
stack traceback:
    [C]: in function 'nvim_win_get_config'
    ...lazy/nvim-notify/lua/telescope/_extensions/notify.lua:105: in function 'define_preview'
    ...telescope.nvim/lua/telescope/previewers/buffer_previewer.lua:454: in function 'preview'
    ...

The error fires on every arrow-key navigation (shift_selection) and on VimResized, making the picker unusable.

Cause

telescope.nvim dropped the status.preview_win field in nvim-telescope/telescope.nvim@e6cdb4d (feat!: require Nvim 0.11 and drop compat shims, #3636). The preview window id is now exposed as status.layout.preview.winid (see telescope's own buffer_previewer.lua:419). status.preview_win is therefore nil, which nvim_win_get_config rejects.

Fix

Resolve the preview window id via status.layout.preview.winid, falling back to status.preview_win for backward compatibility with older telescope versions.

local preview_win = (status.layout and status.layout.preview and status.layout.preview.winid)
  or status.preview_win

Testing

  • Opened :Telescope notify with a few queued notifications.
  • Navigated with <C-n> / <C-p> — preview renders, no more Invalid 'window' error.
  • Resized the terminal while the picker was open — VimResized autocmd no longer throws.
  • Sanity-checked against an older telescope (where only status.preview_win exists) — fallback keeps the extension working.

Telescope removed `status.preview_win` in
nvim-telescope/telescope.nvim@e6cdb4d ("require Nvim 0.11 and drop
compat shims", #3636). The previewer now exposes the preview window id
as `status.layout.preview.winid`.

Navigating `:Telescope notify` on current telescope raises
`Invalid 'window': Expected Lua number` because `status.preview_win`
is nil. Resolve the id via the new field and fall back to the old one
to stay compatible with older telescope versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant