diff --git a/sort.go b/sort.go index a17e4f4..017c026 100644 --- a/sort.go +++ b/sort.go @@ -29,12 +29,12 @@ func (timerlist *TimerList) Sort(sortFlag int) error { default: return errors.New("Unrecognized sort option") } - timerlist.sortFlag = sortFlag + timerlist.SortFlag = sortFlag return nil } func (timerlist *TimerList) refresh() { - timerlist.Sort(timerlist.sortFlag) - for i, t := range timerlist.timers { + timerlist.Sort(timerlist.SortFlag) + for i, t := range timerlist.Timers { t.Id = i } } @@ -45,15 +45,15 @@ type timerlistSort struct { } func (ts *timerlistSort) Len() int { - return len(ts.timerlists.timers) + return len(ts.timerlists.Timers) } func (ts *timerlistSort) Swap(l, r int) { - ts.timerlists.timers[l], ts.timerlists.timers[r] = ts.timerlists.timers[r], ts.timerlists.timers[l] + ts.timerlists.Timers[l], ts.timerlists.Timers[r] = ts.timerlists.Timers[r], ts.timerlists.Timers[l] } func (ts *timerlistSort) Less(l, r int) bool { - return ts.by(ts.timerlists.timers[l], ts.timerlists.timers[r]) + return ts.by(ts.timerlists.Timers[l], ts.timerlists.Timers[r]) } func (timerlist *TimerList) sortBy(by func(t1, t2 *Timer) bool) *TimerList {