From 4991e347dcc6ff6c14443afe9b4d849a67b67944 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Thu, 7 Nov 2024 14:32:18 +0100 Subject: [PATCH] fix(win): dont center float when `relative="cursor"` --- lua/snacks/win.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lua/snacks/win.lua b/lua/snacks/win.lua index 844be745..b9e44128 100644 --- a/lua/snacks/win.lua +++ b/lua/snacks/win.lua @@ -474,6 +474,9 @@ function M:win_opts() opts.height = math.floor(opts.height < 1 and parent.height * opts.height or opts.height) opts.width = math.floor(opts.width < 1 and parent.width * opts.width or opts.width) + if opts.relative == "cursor" then + return opts + end opts.row = opts.row or math.floor((parent.height - opts.height) / 2) opts.col = opts.col or math.floor((parent.width - opts.width) / 2) return opts