File tree 1 file changed +7
-2
lines changed
1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,21 @@ func main() {
41
41
size := len (name )
42
42
43
43
difference := maxSize - size
44
+ if f .IsDir () { difference -- }
44
45
45
- if count + maxSize + 1 > width {
46
+ if count + maxSize + 3 > width {
46
47
buffer .WriteString ("\n " )
47
48
count = 0
48
49
}
49
50
50
51
count += maxSize + 1
51
52
52
53
if f .IsDir () {
54
+ buffer .WriteString (" " )
53
55
buffer .WriteString (dirColor (name ))
56
+ buffer .WriteRune ('/' )
54
57
} else {
58
+ buffer .WriteString (" " )
55
59
buffer .WriteString (name )
56
60
}
57
61
buffer .WriteString (strings .Repeat (" " , difference ))
@@ -70,7 +74,8 @@ func maxSize(files []os.FileInfo) int {
70
74
continue
71
75
}
72
76
name := f .Name ()
73
- size := len (name )
77
+ size := len (name ) + 2
78
+ if f .IsDir () { size ++ }
74
79
if maxSize < size { maxSize = size }
75
80
}
76
81
You can’t perform that action at this time.
0 commit comments