1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 06:49:49 +02:00

44030: prompt: Return error for unrecognised colour name

This commit is contained in:
dana 2019-02-03 11:55:40 -06:00
parent 4f6ac08af3
commit ed4c8f3d5e
3 changed files with 15 additions and 0 deletions

View File

@ -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

View File

@ -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);

View File

@ -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