New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Neovim function curwin_col_off (FFI) does not exist anymore #38
Comments
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
|
bbjornstad
added a commit
to bbjornstad/pretty-fold.nvim
that referenced
this issue
Apr 5, 2024
…off` It would seem as though this FFI binding was removed in commit [08fc1eb](neovim/neovim@08fc1eb). Hence the plugin is broken until the interoperability in pretty-fold is fixed, which is hopefully achieved with this patch, courtesy of [cassava](https://github.com/cassava).
bbjornstad
added a commit
to bbjornstad/pretty-fold.nvim
that referenced
this issue
Apr 5, 2024
fix(ffi): fix anuvyklack#38 bug in C interop: removal of `curwin_col_off`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In this commit it was removed.
The current code would need to be replaced with something like:
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.The text was updated successfully, but these errors were encountered: