Skip to content

Commit

Permalink
don't expand text param templates if the param's value is the empty s…
Browse files Browse the repository at this point in the history
…tring
  • Loading branch information
tek committed Jun 28, 2024
1 parent 8f38fa3 commit d573e24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion packages/myo/lib/Myo/Command/CommandSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ compileParam lookup noParam dynamic sub ptag seg = do
(ParamOptional, UndefinedParam) -> pure ""
(ParamOptional, DefinedParam t) -> dynamic ptag t
(ParamTemplate _, UndefinedParam) -> pure ""
(ParamTemplate _, DefinedParam _) -> sub
(ParamTemplate _, DefinedParam t)
| Text.null t -> pure ""
| otherwise -> sub
(ParamFlagTemplate _, UndefinedParam) -> pure ""
(ParamFlagTemplate _, DefinedParam True) -> sub
(ParamFlagTemplate _, DefinedParam False) -> pure ""
Expand Down
3 changes: 2 additions & 1 deletion packages/test/test/Myo/Test/Command/CommandMenuTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ commandEdit =
Command.consSpec (CommandInterpreter.System Nothing) "1" spec
where
spec = CommandSpec tpl (coerce params)
tpl = parseCommandTemplate' ["{par1} {par2}"]
tpl = parseCommandTemplate' ["{par1} {par2}{par4:sub}"]

editEvents :: [PromptEvent]
editEvents =
[
Mapping "k",
Mapping "k",
Mapping "e",
Update "nest: {par3}",
Expand Down

0 comments on commit d573e24

Please sign in to comment.