44030: prompt: Return error for unrecognised colour name

5.9
dana 5 years ago
parent 4f6ac08af3
commit ed4c8f3d5e

@ -1,3 +1,8 @@
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

Loading…
Cancel
Save