Lint
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Junegunn Choi · committed by Junegunn Choi · parent dea60b1 · Browse files · 7 files·+14 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+14 added−12 removed
- other:+14 added−12 removed
Provenance
- Commit
634670e- Tree
6402741- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
dea60b1
7 files changed+14 added−12 removed
modified:src/constants.go+1 added-1 removed
6 unmodified lines7 )8 9 const (10 // Current version11- Version = "0.10.1"11+ version = "0.10.1"12 13 // Core14 coordinatorDelayMax time.Duration = 100 * time.Millisecond15 coordinatorDelayStep time.Duration = 10 * time.Millisecond34 unmodified linesmodified:src/core.go+1 added-1 removed
53 unmodified lines54 sort := opts.Sort > 055 rankTiebreak = opts.Tiebreak56 57 if opts.Version {58- fmt.Println(Version)58+ fmt.Println(version)59 os.Exit(0)60 }61 62 // Event channel205 unmodified linesmodified:src/history.go+2 added
5 unmodified lines6 "os"7 "strings"8 )9 10+// History struct represents input history11 type History struct {12 path string13 lines []string14 modified map[int]string15 maxSize int16 cursor int17 }18 19+// NewHistory returns the pointer to a new History struct20 func NewHistory(path string, maxSize int) (*History, error) {21 fmtError := func(e error) error {22 if os.IsPermission(e) {23 return errors.New("permission denied: " + path)73 unmodified linesmodified:src/matcher.go+1 added-1 removed
94 unmodified lines95 merger, cancelled = m.scan(request)96 }97 98 if !cancelled {99- if merger.Cacheable() {99+ if merger.cacheable() {100 m.mergerCache[patternString] = merger101 }102 merger.final = request.final103 m.eventBox.Set(EvtSearchFin, merger)118 unmodified linesmodified:src/merger.go+1 added-1 removed
80 unmodified lines81 }82 panic(fmt.Sprintf("Index out of bounds (unsorted, %d/%d)", idx, mg.count))83 }84 85-func (mg *Merger) Cacheable() bool {85+func (mg *Merger) cacheable() bool {86 return mg.count < mergerCacheMax87 }88 89 func (mg *Merger) mergedGet(idx int) *Item {29 unmodified linesmodified:src/options.go+1 added-1 removed
511 unmodified lines512 keymap[key] = actClearScreen513 case "delete-char":514 keymap[key] = actDeleteChar515 case "delete-char/eof":516- keymap[key] = actDeleteCharEof516+ keymap[key] = actDeleteCharEOF517 case "end-of-line":518 keymap[key] = actEndOfLine519 case "cancel":520 keymap[key] = actCancel377 unmodified linesmodified:src/terminal.go+7 added-7 removed
104 unmodified lines105 actBackwardWord106 actCancel107 actClearScreen108 actDeleteChar109- actDeleteCharEof109+ actDeleteCharEOF110 actEndOfLine111 actForwardChar112 actForwardWord113 actKillLine26 unmodified lines140 keymap[C.CtrlC] = actAbort141 keymap[C.CtrlG] = actAbort142 keymap[C.CtrlQ] = actAbort143 keymap[C.ESC] = actAbort144- keymap[C.CtrlD] = actDeleteCharEof144+ keymap[C.CtrlD] = actDeleteCharEOF145 keymap[C.CtrlE] = actEndOfLine146 keymap[C.CtrlF] = actForwardChar147 keymap[C.CtrlH] = actBackwardDeleteChar148 keymap[C.BSpace] = actBackwardDeleteChar286 unmodified lines435 idx = len(t.header) - idx - 1436 }437 line := idx + 2438 if t.inlineInfo {439- line -= 1439+ line--440 }441 if line >= max {442 continue443 }17 unmodified lines461 count := t.merger.Length() - t.offset462 for i := 0; i < maxy; i++ {463 line := i + 2 + len(t.header)464 if t.inlineInfo {465- line -= 1465+ line--466 }467 t.move(line, 0, true)468 if i < count {469 t.printItem(t.merger.Get(i+t.offset), i == t.cy-t.offset)391 unmodified lines861 case actAbort:862 req(reqQuit)863 case actDeleteChar:864 t.delChar()865- case actDeleteCharEof:865+ case actDeleteCharEOF:866 if !t.delChar() && t.cx == 0 {867 req(reqQuit)868 }869 case actEndOfLine:142 unmodified lines1012 my = t.maxHeight() - my - 11013 }1014 min := 2 + len(t.header)1015 if t.inlineInfo {1016- min -= 11016+ min--1017 }1018 if me.Double {1019 // Double-click1020 if my >= min {77 unmodified lines1098 1099 func (t *Terminal) maxItems() int {1100 max := t.maxHeight() - 2 - len(t.header)1101 if t.inlineInfo {1102- max += 11102+ max++1103 }1104 return util.Max(max, 0)1105 }