Store a pointer to eval.Evaler in edit.Editor

This commit is contained in:
Qi Xiao 2016-01-25 22:14:12 +01:00
parent 5c64fa16e0
commit cca6d75c36
2 changed files with 5 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import (
"syscall"
"time"
"github.com/elves/elvish/eval"
"github.com/elves/elvish/store"
"github.com/elves/elvish/sys"
)
@ -52,6 +53,7 @@ type Editor struct {
sigs <-chan os.Signal
histories []string
store *store.Store
evaler *eval.Evaler
cmdSeq int
editorState
}
@ -142,7 +144,7 @@ func (ed *Editor) nextHistory() bool {
}
// NewEditor creates an Editor.
func NewEditor(file *os.File, sigs <-chan os.Signal, st *store.Store) *Editor {
func NewEditor(file *os.File, sigs <-chan os.Signal, ev *eval.Evaler, st *store.Store) *Editor {
seq := -1
if st != nil {
var err error
@ -159,6 +161,7 @@ func NewEditor(file *os.File, sigs <-chan os.Signal, st *store.Store) *Editor {
reader: NewReader(file),
sigs: sigs,
store: st,
evaler: ev,
cmdSeq: seq,
}
}

View File

@ -78,7 +78,7 @@ func interact() {
sigch := make(chan os.Signal, sigchSize)
ed := edit.NewEditor(os.Stdin, sigch, st)
ed := edit.NewEditor(os.Stdin, sigch, ev, st)
for {
cmdNum++