File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change 88 dirSortLast dirSort = 1
99)
1010
11+ const (
12+ nameAsc byte = 'n'
13+ nameDesc byte = 'N'
14+ sizeAsc byte = 's'
15+ sizeDesc byte = 'S'
16+ timeAsc byte = 't'
17+ timeDesc byte = 'T'
18+ )
19+
1120type SortState struct {
1221 dirSort dirSort
1322 key byte
@@ -51,32 +60,32 @@ func (info SortState) NextDirSort() string {
5160func (info SortState ) NextNameSort () string {
5261 var nextKey byte
5362 switch info .key {
54- case 'n' :
55- nextKey = 'N'
63+ case nameAsc :
64+ nextKey = nameDesc
5665 default :
57- nextKey = 'n'
66+ nextKey = nameAsc
5867 }
5968 return info .mergeDirWithKey (nextKey )
6069}
6170
6271func (info SortState ) NextSizeSort () string {
6372 var nextKey byte
6473 switch info .key {
65- case 's' :
66- nextKey = 'S'
74+ case sizeAsc :
75+ nextKey = sizeDesc
6776 default :
68- nextKey = 's'
77+ nextKey = sizeAsc
6978 }
7079 return info .mergeDirWithKey (nextKey )
7180}
7281
7382func (info SortState ) NextTimeSort () string {
7483 var nextKey byte
7584 switch info .key {
76- case 't' :
77- nextKey = 'T'
85+ case timeAsc :
86+ nextKey = timeDesc
7887 default :
79- nextKey = 't'
88+ nextKey = timeAsc
8089 }
8190 return info .mergeDirWithKey (nextKey )
8291}
You can’t perform that action at this time.
0 commit comments