package edit
import (
)
var errStoreOffline = errors.New("store offline")
func ( histutil.Store, chan<- interface{}) error {
if == nil {
return errStoreOffline
}
, := .AllCmds()
if != nil {
return
}
for , := range {
<- vals.MakeMap("id", strconv.Itoa(.Seq), "cmd", .Text)
}
return nil
}
func ( cli.App, histutil.Store) error {
:= .Cursor("")
.Prev()
, := .Get()
if != nil {
return
}
:= parseutil.Wordify(.Text)
if len() > 0 {
.CodeArea().MutateState(func( *tk.CodeAreaState) {
.Buffer.InsertAtDot([len()-1])
})
}
return nil
}
func ( cli.App, eval.NsBuilder, histutil.Store) {
.AddGoFns("<edit>", map[string]interface{}{
"command-history": func( *eval.Frame) error {
return commandHistory(, .OutputChan())
},
"insert-last-word": func() { insertLastWord(, ) },
})
}