Neovim function curwin_col_off (FFI) does not exist anymore
In this commit it was removed.
The current code would need to be replaced with something like:
ffi.cdef [[
 typedef struct window_S win_T;
 int win_col_off(win_T *wp);
 extern win_T *curwin;
]]
function curwin_col_off()
return ffi.C.win_col_off(ffi.C.curwin)
end
The function win_col_off does not appear to be new, so using this new approach should not cause problems for those on older versions of Neovim.
Here's what a patch could look like:
diff --git a/lua/pretty-fold/init.lua b/lua/pretty-fold/init.lua
index b0b3788..09776ae 100644
--- a/lua/pretty-fold/init.lua
+++ b/lua/pretty-fold/init.lua
@@ -3,7 +3,11 @@ local wo = vim.wo
local fn = vim.fn
local api = vim.api
-ffi.cdef('int curwin_col_off(void);')
+ffi.cdef [[
+ typedef struct window_S win_T;
+ int win_col_off(win_T *wp);
+ extern win_T *curwin;
+]]
local M = {
foldtext = {}, -- Table with all 'foldtext' functions.
@@ -82,7 +86,7 @@ local function fold_text(config)
---The width of offset of a window, occupied by line number column,
---fold column and sign column.
---@type number
- local gutter_width = ffi.C.curwin_col_off()
+ local gutter_width = ffi.C.win_col_off(ffi.C.curwin)
local visible_win_width = api.nvim_win_get_width(0) - gutter_width
I'm having this issue too with Nvim 0.10.0. The proposed fix seems to work for me. Is something other than free time holding back this PR from getting merged...?
Hmm, the issue make neovim crash. Is there any plan merge #39 ? Thanks.
FWIW, there are some forks out there with the fix implemented: https://github.com/bbjornstad/pretty-fold.nvim
Easy swap if you're using a plugin manager. Might switch back to anuvyklack, but seems like there's low bandwidth.
@l00sed Great! I'll try to use the fork instead. Thanks.