From 550ec19aed7cf70c6e2078393fae5d8cc4c97818 Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 16 Oct 2026 10:14:48 -0400 Subject: [PATCH] refactor!: drop support for Neovim v0.11 --- README.md | 2 +- doc/astroui.txt | 2 +- lua/astroui/ffi.lua | 22 ------------------ lua/astroui/lazygit.lua | 18 +-------------- lua/astroui/status/provider.lua | 41 +-------------------------------- 5 files changed, 4 insertions(+), 81 deletions(-) delete mode 100644 lua/astroui/ffi.lua diff --git a/README.md b/README.md index 93253f0..7fc2d23 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ AstroUI provides a simple API for configuring and setting up the user interface ## ⚡️ Requirements -- Neovim >= 0.11 +- Neovim >= 0.12 - [astrocore][astrocore] ## 📦 Installation diff --git a/doc/astroui.txt b/doc/astroui.txt index 0a907d4..3f17b8a 100644 --- a/doc/astroui.txt +++ b/doc/astroui.txt @@ -38,7 +38,7 @@ FEATURES *astroui-astroui-features* REQUIREMENTS *astroui-astroui-requirements* -- Neovim >= 0.11 +- Neovim >= 0.12 - astrocore diff --git a/lua/astroui/ffi.lua b/lua/astroui/ffi.lua deleted file mode 100644 index 7b1ff30..0000000 --- a/lua/astroui/ffi.lua +++ /dev/null @@ -1,22 +0,0 @@ --- AstroUI C Extensions - --- TODO: Delete when dropping support for Neovim v0.11 - -local ffi = require "ffi" - --- Custom C extension to get direct fold information from Neovim -ffi.cdef [[ - typedef struct {} Error; - typedef struct {} win_T; - typedef struct { - int start; // line number where deepest fold starts - int level; // fold level, when zero other fields are N/A - int llevel; // lowest level that starts in v:lnum - int lines; // number of lines from v:lnum to end of closed fold - } foldinfo_T; - foldinfo_T fold_info(win_T* wp, int lnum); - win_T *find_window_by_handle(int Window, Error *err); - int compute_foldcolumn(win_T *wp, int col); -]] - -return ffi diff --git a/lua/astroui/lazygit.lua b/lua/astroui/lazygit.lua index 4115c7b..dc34bd1 100644 --- a/lua/astroui/lazygit.lua +++ b/lua/astroui/lazygit.lua @@ -62,16 +62,6 @@ function M.update_config() ---@type table local theme = vim.empty_dict() - -- Check if TUI is attached - -- TODO: REMOVE WHEN DROPPING SUPPORT FOR NEOVIM v0.11 - local tui_attached = false - for _, ui in ipairs(vim.api.nvim_list_uis()) do - if ui.chan == 1 and ui.stdout_tty then - tui_attached = true - break - end - end - for k, v in pairs(config.theme or {}) do local color = {} for _, c in ipairs { "fg", "bg" } do @@ -83,13 +73,7 @@ function M.update_config() for _, modifier in ipairs { "bold", "reverse", "underline", "strikethrough" } do if v[modifier] then table.insert(color, modifier) end end - if type(k) == "number" then - -- numeric keys set terminal palette entries, which only a terminal can act on - -- TODO: REMOVE io.write WHEN DROPPING SUPPORT FOR NEOVIM v0.11 - if tui_attached then pcall(vim.api.nvim_ui_send or io.write, ("\27]4;%d;%s\7"):format(k, color[1])) end - else - theme[k] = color - end + if type(k) ~= "number" then theme[k] = color end end local lg_config = vim.tbl_deep_extend("force", { gui = { theme = theme } }, config.config or {}) diff --git a/lua/astroui/status/provider.lua b/lua/astroui/status/provider.lua index 63af3e3..c35a5f7 100644 --- a/lua/astroui/status/provider.lua +++ b/lua/astroui/status/provider.lua @@ -101,46 +101,7 @@ end -- @see astroui.status.utils.stylize function M.foldcolumn(opts) opts = extend_tbl(vim.tbl_get(config, "providers", "foldcolumn"), opts) - if vim.fn.has "nvim-0.12" == 1 then return status_utils.stylize("%C", opts) end - -- TODO: Remove code when deprecating Neovim 0.11 support - local ffi = require "astroui.ffi" -- get AstroUI C extensions - return function() -- move to M.fold_indicator - local fillchars = vim.opt_local.fillchars:get() - local foldopen = fillchars.foldopen or get_icon "FoldOpened" - local foldclosed = fillchars.foldclose or get_icon "FoldClosed" - local foldsep = fillchars.foldsep or get_icon "FoldSeparator" - local wp = ffi.C.find_window_by_handle(0, ffi.new "Error") -- get window handler - local width = ffi.C.compute_foldcolumn(wp, 0) -- get foldcolumn width - -- get fold info of current line - local foldinfo = width > 0 and ffi.C.fold_info(wp, vim.v.lnum) or { start = 0, level = 0, llevel = 0, lines = 0 } - - local str = "" - if width ~= 0 then - str = vim.v.relnum > 0 and "%#FoldColumn#" or "%#CursorLineFold#" - if foldinfo.level == 0 then - str = str .. (" "):rep(width) - else - local closed = foldinfo.lines > 0 - local first_level = foldinfo.level - width - (closed and 1 or 0) + 1 - if first_level < 1 then first_level = 1 end - - for col = 1, width do - str = str - .. ( - (vim.v.virtnum ~= 0 and foldsep) - or ((closed and (col == foldinfo.level or col == width)) and foldclosed) - or ((foldinfo.start == vim.v.lnum and first_level + col > foldinfo.llevel) and foldopen) - or foldsep - ) - if col == foldinfo.level then - str = str .. (" "):rep(width - col) - break - end - end - end - end - return status_utils.stylize(str .. "%*", opts) - end + return status_utils.stylize("%C", opts) end --- A provider function for the current tab number