Request: Add noice support
Opened this issue · 6 comments
When one has smear-cursor.nvim + noice.nvim installed at the same time, the cursor animation should move to the pop-up UI window. But it still goes to the old lower-left command window. See the GIF for a visual representation.
2024-12-28.16-49-08.mp4
It'd be nice if smear-cursor.nvim could animate to wherever the command line start is, even that position is not at the (default) bottom of the screen.
I don't have a clear suggestion on how to implement it. But I did see this in the noice code:
There's also a (small amount of) help docs, :h vim.ui_attach()
, that might help
ns = vim.api.nvim_create_namespace('my_fancy_pum')
vim.ui_attach(ns, {ext_popupmenu=true}, function(event, ...)
if event == "popupmenu_show" then
local items, selected, row, col, grid = ...
print("display pum ", #items)
-- ...
I just added a smear_to_cmd
configuration parameter #77. In the meantime, does setting it to false
solve the issue?
Hi, I just tried it and The animation still wont play within the CMD (Noice) but it does stop moving to the left bottom which mean the config is working.
I just added a
smear_to_cmd
configuration parameter #77. In the meantime, does setting it tofalse
solve the issue?
I won't be at my main computer for a few days. I'll check back in before this weekend
Hi, smear_to_cmd
does remove animations though FWIW I'd rather not use it because if this is fixed in the future, I might miss that update. I'll keep everything enabled even if the animation normal -> cmd -> normal
animation is a little wonky for the time being
The issue potentially comes from noice setting a custom cursor position. I could override the vim.api.nvim_win_set_cursor
function to trigger the smear animation, but that's a bit dirty. Let me know if you have another idea.
I guess it depends on who calls what first. Is the issue that smear-cursor.nvim
is triggering before noice.nvim
sets the cursor position? Or is it that smear-cursor.nvim
does run in the correct order but vim.fn.screenrow()
and vim.fn.screencol()
report incorrect values which causes cursor to move to the wrong position?
Assuming Incorrect Values (And The Call Order Is Already Correct)
We know from #9 (comment) that command mode in Neovim can have some weird redraw / rendering issues. Maybe it's a situation where a redraw is needed and then screenrow
/ screencol
report the right information.
If not that then maybe it's a bug that needs to go to Neovim core. If screenrow
/ screencol
aren't reporting accurate information in command mode then there isn't much that can be done.
Assuming Incorrect Call Order (And It Is Not Incorrect Values)
Considering noice.nvim
overrides other plugin's function calls with its own, smear-cursor.nvim
may want to do the same to noice.nvim
.
Something like
(somewhere in smear-cursor.nvim
)
local success, cmdline = pcall("noice.ui.cmdline")
if success then
local function _override(original)
-- Your preamble code, as needed
original()
-- Your post code, as needed
end
cmdline.fix_cursor = _override(cmdline.fix_cursor)
end