Skip to content

Commit

Permalink
fix(concealer): more precise anticonceal feature detection (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
champignoom committed Sep 15, 2023
1 parent 8200ebc commit b0117a4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lua/neorg/core/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,10 @@ end
---@param patch number #The patch number (in case you need it)
---@return boolean #Whether Neovim is running at the same or a higher version than the one given
function utils.is_minimum_version(major, minor, patch)
return major <= version.major and minor <= version.minor and patch <= version.patch
if major ~= version.major then return major < version.major end
if minor ~= version.minor then return minor < version.minor end
if patch ~= version.patch then return patch < version.patch end
return true
end

--- Parses a version string like "0.4.2" and provides back a table like { major = <number>, minor = <number>, patch = <number> }
Expand Down
16 changes: 15 additions & 1 deletion lua/neorg/modules/core/concealer/module.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,21 @@ end
--- end utils
local has_anticonceal = utils.is_minimum_version(0, 10, 0)
local has_anticonceal = (function()
if not utils.is_minimum_version(0, 10, 0) then
return false
end
if utils.is_minimum_version(0, 10, 1) then
return true
end
local full_version = vim.api.nvim_cmd({cmd="version"}, {output=true})
local _, _, sub_version = string.find(full_version, "-(%d+)[+]")
if not sub_version then return true end -- no longer a dev version
sub_version = tonumber(sub_version)
return sub_version and sub_version > 575
end)()
local module = modules.create("core.concealer", {
"preset_basic",
Expand Down

0 comments on commit b0117a4

Please sign in to comment.