Skip to content

Commit

Permalink
fix(window): don't raise error for unknown relative value
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaitanyabsprip committed Oct 26, 2024
1 parent cc44b73 commit 6a992de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/fastaction/window.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ end
---@param x_offset integer | fun(width: integer): integer
---@param y_offset integer | fun(height: integer): integer
---@param relative 'editor' | 'cursor' | 'win' | 'mouse'
---@return integer, integer
---@return integer | nil, integer | nil
function m.get_offsets(x_offset, y_offset, relative)
vim.validate {
['opts.x_offset'] = { x_offset, { 'n', 'f' }, true },
Expand All @@ -84,7 +84,7 @@ function m.get_offsets(x_offset, y_offset, relative)
width = vim.api.nvim_win_get_width(0)
height = vim.api.nvim_win_get_height(0)
else
error 'invalid arguments'
return nil, nil
end

if type(x_offset) == 'function' then x_offset = x_offset(width) end
Expand Down

0 comments on commit 6a992de

Please sign in to comment.