fix(struct_tags): as it turns out it didnt work as i supposed to before, but now it does

This commit is contained in:
Oleksandr Smirnov 2025-03-02 17:16:41 +02:00
parent 9fcff3bb2a
commit 3405161580
No known key found for this signature in database

View file

@ -94,13 +94,14 @@ end
-- add tags to struct under cursor -- add tags to struct under cursor
function struct_tags.add(...) function struct_tags.add(...)
local arg = { ... } local user_tags = { ... }
if #arg == nil or arg == "" then if #user_tags == 0 then
arg = { c.gotag.default_tag } vim.print("c.gotag.default_tag", c.gotag.default_tag)
user_tags = { c.gotag.default_tag }
end end
local cmd_args = { "-add-tags" } local cmd_args = { "-add-tags" }
for _, v in ipairs(arg) do for _, v in ipairs(user_tags) do
table.insert(cmd_args, v) table.insert(cmd_args, v)
end end
@ -109,13 +110,13 @@ end
-- remove tags to struct under cursor -- remove tags to struct under cursor
function struct_tags.remove(...) function struct_tags.remove(...)
local arg = { ... } local user_tags = { ... }
if #arg == nil or arg == "" then if #user_tags == 0 then
arg = { c.gotag.default_tag } user_tags = { c.gotag.default_tag }
end end
local cmd_args = { "-remove-tags" } local cmd_args = { "-remove-tags" }
for _, v in ipairs(arg) do for _, v in ipairs(user_tags) do
table.insert(cmd_args, v) table.insert(cmd_args, v)
end end