refactor: absorb statusline offset into indicator padding
Remove the hardcoded statusline_offset from calculate_position() and let padding.y serve as the sole offset from the bottom edge. Bump default padding.y to 3 to preserve the original visual position.
This commit is contained in:
@@ -69,7 +69,7 @@ local defaults = {
|
||||
failure_hl = "WatchexecFailure",
|
||||
width = 2,
|
||||
height = 1,
|
||||
padding = { x = 1, y = 1 },
|
||||
padding = { x = 1, y = 3 },
|
||||
patterns = {
|
||||
success = "%[Command was successful%]",
|
||||
running = "%[Running",
|
||||
|
||||
@@ -36,20 +36,19 @@ local function calculate_position()
|
||||
local width = cfg.width or 2
|
||||
local height = cfg.height or 1
|
||||
local pad_x = cfg.padding and cfg.padding.x or 1
|
||||
local pad_y = cfg.padding and cfg.padding.y or 1
|
||||
local statusline_offset = 2
|
||||
local pad_y = cfg.padding and cfg.padding.y or 3
|
||||
|
||||
if cfg.position == "bottom-left" then
|
||||
return vim.o.lines - height - statusline_offset, pad_x
|
||||
return vim.o.lines - height - pad_y, pad_x
|
||||
elseif cfg.position == "bottom-right" then
|
||||
return vim.o.lines - height - statusline_offset, vim.o.columns - width - pad_x
|
||||
return vim.o.lines - height - pad_y, vim.o.columns - width - pad_x
|
||||
elseif cfg.position == "top-left" then
|
||||
return pad_y, pad_x
|
||||
elseif cfg.position == "top-right" then
|
||||
return pad_y, vim.o.columns - width - pad_x
|
||||
end
|
||||
|
||||
return vim.o.lines - height - statusline_offset, pad_x
|
||||
return vim.o.lines - height - pad_y, pad_x
|
||||
end
|
||||
|
||||
local function close_float()
|
||||
|
||||
Reference in New Issue
Block a user