feat(layout_config): add anchor_padding option (#3035)
This commit is contained in:
@@ -194,6 +194,10 @@ local shared_options = {
|
||||
scroll_speed = "The number of lines to scroll through the previewer",
|
||||
prompt_position = { "Where to place prompt window.", "Available Values: 'bottom', 'top'" },
|
||||
anchor = { "Which edge/corner to pin the picker to", "See |resolver.resolve_anchor_pos()|" },
|
||||
anchor_padding = {
|
||||
"Specifies an amount of additional padding around the anchor",
|
||||
"Values should be a positive integer",
|
||||
},
|
||||
}
|
||||
|
||||
-- Used for generating vim help documentation.
|
||||
@@ -375,7 +379,10 @@ layout_strategies.horizontal = make_documented_layout(
|
||||
error(string.format("Unknown prompt_position: %s\n%s", self.window.prompt_position, vim.inspect(layout_config)))
|
||||
end
|
||||
|
||||
local anchor_pos = resolve.resolve_anchor_pos(layout_config.anchor or "", width, height, max_columns, max_lines)
|
||||
local anchor = layout_config.anchor or ""
|
||||
local anchor_padding = layout_config.anchor_padding or 1
|
||||
|
||||
local anchor_pos = resolve.resolve_anchor_pos(anchor, width, height, max_columns, max_lines, anchor_padding)
|
||||
adjust_pos(anchor_pos, prompt, results, preview)
|
||||
|
||||
if tbln then
|
||||
@@ -486,7 +493,9 @@ layout_strategies.center = make_documented_layout(
|
||||
results.col, preview.col, prompt.col = width_padding, width_padding, width_padding
|
||||
|
||||
local anchor = layout_config.anchor or ""
|
||||
local anchor_pos = resolve.resolve_anchor_pos(anchor, width, height, max_columns, max_lines)
|
||||
local anchor_padding = layout_config.anchor_padding or 1
|
||||
|
||||
local anchor_pos = resolve.resolve_anchor_pos(anchor, width, height, max_columns, max_lines, anchor_padding)
|
||||
adjust_pos(anchor_pos, prompt, results, preview)
|
||||
|
||||
-- Vertical anchoring (S or N variations) ignores layout_config.mirror
|
||||
@@ -740,7 +749,10 @@ layout_strategies.vertical = make_documented_layout(
|
||||
end
|
||||
end
|
||||
|
||||
local anchor_pos = resolve.resolve_anchor_pos(layout_config.anchor or "", width, height, max_columns, max_lines)
|
||||
local anchor = layout_config.anchor or ""
|
||||
local anchor_padding = layout_config.anchor_padding or 1
|
||||
|
||||
local anchor_pos = resolve.resolve_anchor_pos(anchor, width, height, max_columns, max_lines, anchor_padding)
|
||||
adjust_pos(anchor_pos, prompt, results, preview)
|
||||
|
||||
if tbln then
|
||||
|
||||
Reference in New Issue
Block a user