mirror of
https://github.com/walles/moar.git
synced 2024-09-11 12:15:43 +03:00
Handle reading underline color
This commit is contained in:
parent
065b95a653
commit
f69e58d9b3
@ -585,9 +585,9 @@ func joinUints(ints []uint) string {
|
||||
// * A color value that can be applied to a style
|
||||
func consumeCompositeColor(numbers []uint, index int) (int, *twin.Color, error) {
|
||||
baseIndex := index
|
||||
if numbers[index] != 38 && numbers[index] != 48 {
|
||||
if numbers[index] != 38 && numbers[index] != 48 && numbers[index] != 58 {
|
||||
err := fmt.Errorf(
|
||||
"unknown start of color sequence <%d>, expected 38 (foreground) or 48 (background): <CSI %sm>",
|
||||
"unknown start of color sequence <%d>, expected 38 (foreground), 48 (background) or 58 (underline): <CSI %sm>",
|
||||
numbers[index],
|
||||
joinUints(numbers[baseIndex:]))
|
||||
return -1, nil, err
|
||||
|
@ -216,7 +216,7 @@ func TestConsumeCompositeColorBadPrefix(t *testing.T) {
|
||||
// 8 bit color
|
||||
// Example from: https://github.com/walles/moar/issues/14
|
||||
_, color, err := consumeCompositeColor([]uint{29}, 0)
|
||||
assert.Equal(t, err.Error(), "unknown start of color sequence <29>, expected 38 (foreground) or 48 (background): <CSI 29m>")
|
||||
assert.Equal(t, err.Error(), "unknown start of color sequence <29>, expected 38 (foreground), 48 (background) or 58 (underline): <CSI 29m>")
|
||||
assert.Assert(t, color == nil)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user