cli: Move StartHistlist to histlist_mode.go.

This commit is contained in:
Qi Xiao 2019-05-02 01:29:23 +01:00
parent 67f4027013
commit 974407ca10
2 changed files with 17 additions and 17 deletions

View File

@ -23,20 +23,3 @@ func DefaultInsert(ev KeyEvent) {
ev.CommitEOF()
}
}
// StartHistlist starts the history listing mode.
func StartHistlist(ev KeyEvent) {
historyStore := ev.App().cfg.HistoryStore
if historyStore == nil {
ev.State().AddNote("no history store")
return
}
cmds, err := historyStore.AllCmds()
if err != nil {
ev.State().AddNote("db error: " + err.Error())
return
}
mode := ev.App().histlist
mode.Start(cmds)
ev.State().SetMode(mode)
}

View File

@ -5,3 +5,20 @@ package cli
type HistlistModeConfig struct {
Binding Binding
}
// StartHistlist starts the history listing mode.
func StartHistlist(ev KeyEvent) {
historyStore := ev.App().cfg.HistoryStore
if historyStore == nil {
ev.State().AddNote("no history store")
return
}
cmds, err := historyStore.AllCmds()
if err != nil {
ev.State().AddNote("db error: " + err.Error())
return
}
mode := ev.App().histlist
mode.Start(cmds)
ev.State().SetMode(mode)
}