Repository: gokcehan/lf (go)

Issue:
directories no longer bolded
```
~ $ lf -version 
34.r5.g7797ad6 
```

after updating today the only directories that are bolded are the ones with 777 permissions, where as previously all were bolded. presumably this is caused by one of the commits from feb 9?

Pull request description:
Handle leading zeros in SGR escape sequences
- Fixes #1911

Patch:
diff --git a/colors.go b/colors.go
index 69c5bb1..54e5b21 100644
--- a/colors.go
+++ b/colors.go
@@ -103,8 +103,8 @@ func applyAnsiCodes(s string, st tcell.Style) tcell.Style {
 	//    Probably because this is used for previewers too
 	tokslen := len(toks)
 	for i := 0; i < tokslen; i++ {
-		switch toks[i] {
-		case "", "0":
+		switch strings.TrimLeft(toks[i], "0") {
+		case "":
 			st = tcell.StyleDefault
 		case "1":
 			st = st.Bold(true)


Test patch:
diff --git a/colors_test.go b/colors_test.go
index e7e62e1..8085ce1 100644
--- a/colors_test.go
+++ b/colors_test.go
@@ -53,6 +53,9 @@ func TestApplyAnsiCodes(t *testing.T) {
 		{"1;31", none, none.Foreground(tcell.ColorMaroon).Bold(true)},
 		{"1;31", none.Foreground(tcell.ColorGreen), none.Foreground(tcell.ColorMaroon).Bold(true)},
 
+		{"01;31", none, none.Foreground(tcell.ColorMaroon).Bold(true)},
+		{"01;31", none.Foreground(tcell.ColorGreen), none.Foreground(tcell.ColorMaroon).Bold(true)},
+
 		{"38;5;0", none, none.Foreground(tcell.ColorBlack)},
 		{"38;5;1", none, none.Foreground(tcell.ColorMaroon)},
 		{"38;5;8", none, none.Foreground(tcell.ColorGray)},