Closed queezle42 closed 11 months ago
Honestly, the anchor should not even be a config option anymore. It's left over from a time when there were more ways to configure the nvim_open_win
by passing in static values. That was brittle and not very flexible, so I added the override
function as a config option, which allows you to take the options that dressing calculates and perform whatever mutations you want to it. It's much more flexible, and simpler to boot.
I used to use this so that it would display under the cursor. Any idea what I should use now?
{
input = {
anchor = 'NW',
override = function(conf)
-- display under cursor, not on top of it
if conf.anchor == 'NW' and (conf.row == nil or conf.row == 0) then
conf.row = 1
end
return conf
end,
},
}
This seems to work, but not sure if it will break elsewhere...
if (conf.row == nil or conf.row == 0) then
conf.row = 4
end
@ehaynes99 you can set the anchor in the override function like so:
override = function(conf)
conf.anchor = "NW"
conf.row = 1
end
Describe the bug
vim.ui.input
window (e.g. for LSP rename) covers the cursor / current line when configuringinput.anchor = "NW"
.System information
Screenshots
Additional context From
:help nvim_open_win
:In input.lua,
row
is set, so therow=1
offset is lost: https://github.com/stevearc/dressing.nvim/blob/39611852fd7bbac117e939a26759bb37361f0c90/lua/dressing/input.lua#L249Possible fixes include:
bufpos
instead ofrow
/col
(this seems to be the intended way to position a window relative to buffer text)row
/col
when usingrelative="cursor"
calculate_row
to check theanchor
. I did that before fully understanding the alternatives (I'll open a PR).