refactor!: deprecate the "anchor" config option (#106)

This was left over from before we had the "override" function. Now, it
doesn't make much sense to set the anchor as an option because so much
of the rest of the layout logic depends on the anchor being the default.
If a user wants to customize the layout, the override function is the
way to do it.
This commit is contained in:
Steven Arcangeli 2023-07-29 09:34:59 -07:00
parent 5131545f0a
commit bcaf0d3d6e
3 changed files with 9 additions and 4 deletions

View File

@ -16,7 +16,6 @@ local default_config = {
start_in_insert = true,
-- These are passed to nvim_open_win
anchor = "SW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "cursor",
@ -120,7 +119,6 @@ local default_config = {
-- Options for built-in selector
builtin = {
-- These are passed to nvim_open_win
anchor = "NW",
border = "rounded",
-- 'editor' and 'win' will default to being centered
relative = "editor",
@ -170,6 +168,13 @@ local M = vim.deepcopy(default_config)
M.update = function(opts)
local newconf = vim.tbl_deep_extend("force", default_config, opts or {})
if newconf.input.anchor or newconf.select.builtin.anchor then
vim.notify(
"Deprecated: dressing no longer accepts an 'anchor' option. Use the 'override' function to change the anchor",
vim.log.levels.WARN
)
end
for k, v in pairs(newconf) do
M[k] = v
end

View File

@ -229,7 +229,7 @@ local function create_or_update_win(config, prompt, opts)
else
winopt = {
relative = config.relative,
anchor = config.anchor,
anchor = "SW",
border = config.border,
height = 1,
style = "minimal",

View File

@ -76,7 +76,7 @@ M.select = function(config, items, opts, on_choice)
local col = util.calculate_col(config.relative, width, 0)
local winopt = {
relative = config.relative,
anchor = config.anchor,
anchor = "NW",
row = row,
col = col,
border = config.border,