Skip to content

Commit

Permalink
fix: add TIOCGWINSZ for OpenBSD/FreeBSD, closes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
edluffy committed Oct 9, 2022
1 parent 3389690 commit f5194f7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lua/hologram/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ function state.update_cell_size()
TIOCGWINSZ = 0x5413
elseif vim.fn.has('mac') == 1 then
TIOCGWINSZ = 0x40087468
elseif vim.fn.has('bsd') == 1 then
TIOCGWINSZ = 0x40087468
end

local sz = ffi.new("winsize")
assert(ffi.C.ioctl(1, TIOCGWINSZ, sz) == 0,
'Hologram failed to get screen size: detected OS is not linux or macos.')
'Hologram failed to get screen size: detected OS is not supported.')

state.screen_size.x = sz.xpixel
state.screen_size.y = sz.ypixel
Expand Down

0 comments on commit f5194f7

Please sign in to comment.