New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to not close picker on losing focus #1988
Comments
is this a dup of #1967 If yes i would like to close this. |
I wouldn't say it's a duplicate, their request seems a lot different (ie keeping the picker open when selecting the result, isn't this already possible by remapping the default select action?) |
Ya this is different than that request, though I am unsure how it would be used (as the floating window tends to take up enough screen real estate that I dont imagine you can do much without it being in the way). That said, I dont see this being overly complicated to do as there is no logic (as far as I can tell) that auto closes the floating window. This means that the close happens "manually" (meaning telescope has to close the floating buffer on its own as opposed to Neovim closing it via an event callback). I dont really know how that logic would work though. Allow a user to set an option that says "dont close on selection"? Add a keymap for closing the floating window and infer that that being set means that the window wont close on selection? It seems a bit vague imo. Have any ideas on how you would like to see that implemented? @Zane- |
A floating window taking up real estate is completely dependent on how your telescope is themed though. See this example: In this case, it would be ideal to have the answer be visible after clicking back onto your main buffer, so you can copy it down. I'm not sure what Neovim does when you click off of a popup window, but if there's a way to not auto-close it when you click off of it, then just adding an option to the picker options to not close on losing focus would be nice: opts = {
close_on_lose_focus = false.
}.
picker.new(opts, ...) |
This is a valid point. I will poke about in the internals of this tonight/this weekend (depends on how motivated I feel lol). That said, this doesn't answer the second half of the question. If we are removing the ability to auto close (if an option is set), there must be a way to close the floating window manually. The underlying code exists for this ( @Conni2461 / @fdschmidt93 correct me if I am off base :) |
close is currently bound to What we can do is not register the autocmds that close telescope on focus leave but i dont actually want to support that. It could just lead to a bunch of different problems down the road. We merged a couple of time "simple changes" that caused issues after issues after issues. Thats why i pointed to #1967. Some way to do that but in a more structured way with a lot of autocmds, which prevent focus on results window or preview window. And i still thinks its basically the same. #1967 wants a persistent telescope split where you can hop in and out. And you want to hop out of telescope window but never back in?! Your feature request is pretty short. And hasn't even answered all questions. The only way i would implement that if we prefix that option with |
I haven't read through this issue as a whole, but I don't think the original request should be a configurable option for the time being for telescope. The primary reason is that the general behavior is not super well defined and likely very user specific. In any case, this is perfectly achievable with hacks already local my_action = function(prompt_bufnr)
local current_picker = require "telescope.actions.state".get_current_picker(prompt_bufnr)
vim.cmd(string.format("noautocmd lua vim.api.nvim_set_current_win(%s)", current_picker.original_win_id))
end Getting prompt buffer back vim.tbl_filter(function(b) return vim.bo[b].filetype == "TelescopePrompt" end, vim.api.nvim_list_bufs())[1] barring any typos/mini bugs introduced by on-the-fly typing should work. From a core repo persepective, I'll be honest, this introduces more headache than I would assume anyone of the team would be willing to incur for such a feature. |
One problem that comes to my mind instantly is that if you open a new telescope picker, we close the previous one. So yeah do you to be able to switch buffers while having your telescope "session" open? Because that needs some rework as well. And might lead to even more problems |
Alright, if it would cause too much headache, feel free to close. |
Is your feature request related to a problem? Please describe.
If a picker shows some information that you may need to reference while editing, it would be nice to be able to switch focus off of the picker and not have it close.
Describe the solution you'd like
Add some sort of option to pickers to enable this behavior.
The text was updated successfully, but these errors were encountered: