Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion doc/astroui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ FEATURES *astroui-astroui-features*

REQUIREMENTS *astroui-astroui-requirements*

- Neovim >= 0.11
- Neovim >= 0.12
- astrocore <https://github.com/AstroNvim/astrocore>


Expand Down
22 changes: 0 additions & 22 deletions lua/astroui/ffi.lua

This file was deleted.

18 changes: 1 addition & 17 deletions lua/astroui/lazygit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,6 @@ function M.update_config()
---@type table<string, string[]>
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
Expand All @@ -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 {})
Expand Down
41 changes: 1 addition & 40 deletions lua/astroui/status/provider.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading