From 6a992de1240cbebd6fe6ec1989e4e2a434108d76 Mon Sep 17 00:00:00 2001 From: Chaitanya Sharma Date: Sun, 27 Oct 2024 01:27:02 +0530 Subject: [PATCH] fix(window): don't raise error for unknown relative value --- lua/fastaction/window.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/fastaction/window.lua b/lua/fastaction/window.lua index b963e8c..16c0965 100644 --- a/lua/fastaction/window.lua +++ b/lua/fastaction/window.lua @@ -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 }, @@ -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