Skip to content

Commit

Permalink
fix: Fixed a bug causing incorrect scope_hl in checked & unchecked …
Browse files Browse the repository at this point in the history
…checkboxes

Ref: #177
  • Loading branch information
OXY2DEV committed Jan 10, 2025
1 parent ee7c33e commit 6c0fdb2
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lua/markview/renderers/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,7 @@ markdown.list_item = function (buffer, item)
class = "inline_checkbox",

text = item.checkbox,
range = {}
range = nil
}
};

Expand All @@ -1652,12 +1652,13 @@ markdown.list_item = function (buffer, item)
end

if state == "x" or state == "X" then
return utils.match(checkboxes, "checked", { eval_args = chk_args });
return spec.get({ "checked" }, { source = checkboxes, eval_args = chk_args });
elseif state == " " then
return utils.match(checkboxes, "unchecked", { eval_args = chk_args });
return spec.get({ "unchecked" }, { source = checkboxes, eval_args = chk_args });
end

return utils.match(checkboxes, state, { eval_args = chk_args });
local _state = utils.escape_string(state) or "";
return utils.match(checkboxes, "^" .. _state .. "$", { default = false, ignore_keys = { "checked", "unchecked", "enable" }, eval_args = chk_args });
end

local checkbox = get_state(item.checkbox);
Expand Down Expand Up @@ -2887,7 +2888,7 @@ markdown.__list_item = function (buffer, item)
class = "inline_checkbox",

text = item.checkbox,
range = {}
range = nil
}
};

Expand All @@ -2902,9 +2903,9 @@ markdown.__list_item = function (buffer, item)
end

if state == "x" or state == "X" then
return utils.match(checkboxes, "checked", { eval_args = chk_args });
return spec.get({ "checked" }, { source = checkboxes, eval_args = chk_args });
elseif state == " " then
return utils.match(checkboxes, "unchecked", { eval_args = chk_args });
return spec.get({ "unchecked" }, { source = checkboxes, eval_args = chk_args });
end

return utils.match(checkboxes, state, { eval_args = chk_args });
Expand Down

0 comments on commit 6c0fdb2

Please sign in to comment.