Skip to content

Commit

Permalink
Fix a special case in concat one letter flags.
Browse files Browse the repository at this point in the history
When both "-x" and "-x-" were specified, then the "-x-" accidentally
disabled one letter concat support for "-x".
  • Loading branch information
chrisant996 committed Aug 14, 2024
1 parent 6c261e9 commit f2e992e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
6 changes: 0 additions & 6 deletions completions/dirx.lua
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ end
-- the hide_unless stuff in general.
local minus_flags = { concat_one_letter_flags=true, onarg=onarg_dirxcmd }
local slash_flags = { concat_one_letter_flags=true }
local one_letter_flags = {}

local function copy_vars(entry, tbl)
tbl.hide = entry.hide
Expand Down Expand Up @@ -352,11 +351,6 @@ for _, entry in ipairs(list_of_flags) do
else
error("unrecognized flag entry format.")
end

if not long then
table.insert(one_letter_flags, minus)
table.insert(one_letter_flags, slash)
end
end

clink.argmatcher("dirx")
Expand Down
5 changes: 3 additions & 2 deletions modules/arghelper.lua
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ if not tmp._addexflags or not tmp._addexarg then
end

local function maybe_one_letter_flag(concat_flags, flag, arginfo, linked)
if is_one_letter_flag(flag) then
local letter,plusminus = is_one_letter_flag(flag)
if letter then
table.insert(concat_flags, flag)
local tbl = concat_flags[flag]
if not tbl then
Expand All @@ -491,7 +492,7 @@ if not tmp._addexflags or not tmp._addexarg then
tbl.one_letter_linked = true
end
end
if #flag > 2 then
if #flag > 2 and not plusminus then
local flag2 = flag:sub(1, 2)
if is_one_letter_flag(flag2) and concat_flags[flag2] then
concat_flags[flag2].one_letter_arginfo = true
Expand Down

0 comments on commit f2e992e

Please sign in to comment.