From 24a82b9dad1cbe109d9fb5753c429fd37b1618cd Mon Sep 17 00:00:00 2001 From: Stephane Chazelas Date: Wed, 9 Sep 2020 11:27:47 +0100 Subject: 47352 (+ extra test cases): fix %K prompt expansion Fixed a regression introduced by workers/30496 (5.0.3) whereby %2K would no longer be the equivalent of %K{2} (%K{green}) in prompt expansion. That was one missing case where the is_fg flag was not passed along to match_colour() after code factorisation. Add tests for the different syntax variants, using echoti as a reference. --- Test/D01prompt.ztst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Test') diff --git a/Test/D01prompt.ztst b/Test/D01prompt.ztst index 7ff478e68..3fb27e620 100644 --- a/Test/D01prompt.ztst +++ b/Test/D01prompt.ztst @@ -229,3 +229,31 @@ Ffoo=${(%):-'%F{foo}'} # Unrecognised [[ $f == $Fdefault && $Fdefault == $Freset && $Freset == $Ffoo ]] 0:Regression test for workers/44029 + + if + zmodload zsh/terminfo >& /dev/null && + (( terminfo[colors] >= 8 )) + then + F1=$(echoti setaf 2) + F2=${(%):-%2F} + F3=${(%):-%F{2}} + F4=${(%):-%F{green}} + [[ -n $F1 && $F1 = $F2 && $F2 = $F3 && $F3 = $F4 ]] + else + ZTST_skip='Missing terminfo module or non-colour terminal' + fi +0:Equivalence of terminal colour settings (foreground colour) + + if + zmodload zsh/terminfo >& /dev/null && + (( terminfo[colors] >= 8 )) + then + K1=$(echoti setab 2) + K2=${(%):-%2K} + K3=${(%):-%K{2}} + K4=${(%):-%K{green}} + [[ -n $K1 && $K1 = $K2 && $K2 = $K3 && $K3 = $K4 ]] + else + ZTST_skip='Missing terminfo module or non-colour terminal' + fi +0:Equivalence of terminal colour settings (background colour) -- cgit v1.2.3-70-g09d2