willothy / flatten.nvim

Open files and command output from wezterm, kitty, and neovim terminals in your current neovim instance
https://luarocks.org/modules/willothy/flatten.nvim
MIT License
473 stars 13 forks source link

fix: returned truthy of vim.fn #92

Closed kjuq closed 7 months ago

kjuq commented 7 months ago

In Lua, integer value is always recognized as true. So we should check if a returned value from vim.fn.has("win32") is 1 or not.

davidmh commented 7 months ago

I just ran into the same issue, and the fix works for me.

From the Lua docs: https://www.lua.org/pil/2.2.html

Lua considers both zero and the empty string as true in conditional tests

willothy commented 7 months ago

Yes, all values except nil and false are truthy in Lua. My bad, I forgot has returns an int. Should've caught that before merging.

I should really setup CI and tests. I will make sure to do that before I merge the 1.0 patch.

I will merge this fix shortly, sorry for the delay.

willothy commented 7 months ago

Thanks for the PR! I appreciate it.