Commit ed4c8f3d authored by dana's avatar dana

44030: prompt: Return error for unrecognised colour name

parent 4f6ac08a
2019-02-03 dana <dana@dana.is>
* 44030: Src/prompt.c, Test/D01prompt.ztst: Return error for
unrecognised colour name
2019-01-28 Fredric Silberberg <fred@silberberg.xyz>
* github #32: Completion/Unix/Command/_git: Fix a typo in the
......
......@@ -1663,6 +1663,8 @@ match_colour(const char **teststrp, int is_fg, int colour)
/* default */
return is_fg ? TXTNOFGCOLOUR : TXTNOBGCOLOUR;
}
if (colour < 0)
return TXT_ERROR;
}
else {
colour = (int)zstrtol(*teststrp, (char **)teststrp, 10);
......
......@@ -221,3 +221,11 @@
print ${(%U)Y-%(v}
0:Regression test for test on empty psvar
>
# Unrecognised colour strings should produce the default sequence
f=${(%):-'%f'} # Recognised
Fdefault=${(%):-'%F{default}'} # Recognised
Freset=${(%):-'%F{reset}'} # Unrecognised
Ffoo=${(%):-'%F{foo}'} # Unrecognised
[[ $f == $Fdefault && $Fdefault == $Freset && $Freset == $Ffoo ]]
0:Regression test for workers/44029
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment