A long value in the details pane (a ref, a note, a vault's detail, an error) was coloured, then wrapped: the colour's reset only came on the last line, and each line is drawn on its own, so the lines after the first lost the colour. Each wrapped line now starts with the styles still on at the end of the one before. Reviewed-on: #69 Co-authored-by: Karl-Einar Bergstrøm <karl-einarb@outlook.com>
18 lines
453 B
Go
18 lines
453 B
Go
package panes
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestWrappedValueKeepsItsStyle(t *testing.T) {
|
|
red := "\x1b[31m"
|
|
got := carryStyle([]string{red + "@Microsoft.KeyVault(SecretUri=https://kv", "-app-prod.vault.azure.net/secrets/x)\x1b[m", "after"})
|
|
if !strings.HasPrefix(got[1], red) {
|
|
t.Errorf("the wrapped line lost the style: %q", got[1])
|
|
}
|
|
if strings.HasPrefix(got[2], red) {
|
|
t.Errorf("the style went on past its reset: %q", got[2])
|
|
}
|
|
}
|