feat: add hide / unhide preview (#1305)

* feat: add hide / unhide preview or results and prompt

* fix edit actions while only preview window is active

* add option to start telescope without previewer -> "disable_previewer_at_startup"

* remove hide / unhide prompt and resutls, improve hide / unhide preview

* fix tests - check if popup window should be created with borders - popup.create does not support setting borderhighlight and border=false

* allow toggle preview even if preview is set to false

* reuse recalculate_layout in hide / unhide preview

* add docs to toggle preview

* check if preview window is valid window

* remove unnecessary changes

* cleanup, remove unnecessary changes

* close all previewers, refactor toggle preview code

[docgen] Update doc/telescope.txt
skip-checks: true
This commit is contained in:
johnybx
2021-11-08 18:20:17 +01:00
committed by Luke Kershaw
parent e9743620ce
commit b952c2f852
5 changed files with 134 additions and 73 deletions

View File

@@ -438,6 +438,25 @@ function utils.buf_delete(bufnr)
end
end
function utils.win_delete(name, win_id, force, bdelete)
if win_id == nil or not vim.api.nvim_win_is_valid(win_id) then
return
end
local bufnr = vim.api.nvim_win_get_buf(win_id)
if bdelete then
utils.buf_delete(bufnr)
end
if not vim.api.nvim_win_is_valid(win_id) then
return
end
if not pcall(vim.api.nvim_win_close, win_id, force) then
log.trace("Unable to close window: ", name, "/", win_id)
end
end
function utils.max_split(s, pattern, maxsplit)
pattern = pattern or " "
maxsplit = maxsplit or -1