本文整理匯總了Golang中github.com/elves/elvish/eval.Evaler.Editor方法的典型用法代碼示例。如果您正苦於以下問題:Golang Evaler.Editor方法的具體用法?Golang Evaler.Editor怎麽用?Golang Evaler.Editor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/elves/elvish/eval.Evaler
的用法示例。
在下文中一共展示了Evaler.Editor方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: NewEditor
// NewEditor creates an 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
seq, err = st.NextCmdSeq()
if err != nil {
// TODO(xiaq): Also report the error
seq = -1
}
}
prompt, rprompt := defaultPrompts()
ed := &Editor{
file: file,
writer: newWriter(file),
reader: NewReader(file),
sigs: sigs,
store: st,
evaler: ev,
cmdSeq: seq,
ps1: eval.NewPtrVariableWithValidator(prompt, MustBeFn),
rps1: eval.NewPtrVariableWithValidator(rprompt, MustBeFn),
abbreviations: make(map[string]string),
beforeReadLine: eval.NewPtrVariableWithValidator(
eval.NewList(), eval.IsListOfFnValue),
afterReadLine: eval.NewPtrVariableWithValidator(
eval.NewList(), eval.IsListOfFnValue),
}
ev.Editor = ed
ev.Modules["le"] = makeModule(ed)
return ed
}
示例2: NewEditor
// NewEditor creates an 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
seq, err = st.NextCmdSeq()
if err != nil {
// TODO(xiaq): Also report the error
seq = -1
}
}
ed := &Editor{
file: file,
writer: newWriter(file),
reader: NewReader(file),
sigs: sigs,
store: st,
evaler: ev,
cmdSeq: seq,
}
ev.Editor = ed
return ed
}