Skip to content

Commit af7b2ea

Browse files
PriceHillerNTBBloodbath
authored andcommitted
fix: ensure help window width is an int
Problem: The help window causes an error when calling `vim.api.nvim_open_win` because the width being passed is not an integer. Neovim's `vim.api.nvim_open_win` function requires that the width and height be specified in whole integers. The width is being calculated through a division operation causing it to potentially be a number that is not an int. Solution: Floor the calculation of the help window width so the width is always rounded down to the nearest integer and can thus be used with `vim.api.nvim_open_win`.
1 parent b97d394 commit af7b2ea

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lua/rest-nvim/result/help.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function help.open()
6262
end
6363

6464
-- Help window sizing and positioning
65-
local width = vim.api.nvim_win_get_width(winnr) / 2
65+
local width = math.floor(vim.api.nvim_win_get_width(winnr) / 2)
6666
local height = 8
6767

6868
local col = vim.api.nvim_win_get_width(winnr) - width - 4

0 commit comments

Comments
 (0)