mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-14 02:57:52 +08:00
newedit/core -> newedit/clicore.
This commit is contained in:
parent
5eaec24f11
commit
0e5341b8ce
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
|
@ -1,6 +1,6 @@
|
||||||
// Package core defines the core of Elvish's interactive line editor. It is
|
// Package clicore defines the core of Elvish's interactive line editor. It is
|
||||||
// language-agnostic and can be used to build editors for other languages.
|
// language-agnostic and can be used to build editors for other languages.
|
||||||
//
|
//
|
||||||
// The center of this package is the Editor type. Most other types are either
|
// The center of this package is the Editor type. Most other types are either
|
||||||
// states managed by the Editor or dependencies of the Editor.
|
// states managed by the Editor or dependencies of the Editor.
|
||||||
package core
|
package clicore
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import "os"
|
import "os"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import "github.com/elves/elvish/styled"
|
import "github.com/elves/elvish/styled"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import "sync"
|
import "sync"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"reflect"
|
"reflect"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import "github.com/elves/elvish/styled"
|
import "github.com/elves/elvish/styled"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/elves/elvish/edit/ui"
|
"github.com/elves/elvish/edit/ui"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
|
@ -1,6 +1,6 @@
|
||||||
// +build !windows,!plan9
|
// +build !windows,!plan9
|
||||||
|
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
|
@ -1,4 +1,4 @@
|
||||||
package core
|
package clicore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/elves/elvish/newedit/editutil"
|
"github.com/elves/elvish/newedit/editutil"
|
|
@ -6,7 +6,7 @@ import "github.com/elves/elvish/newedit/types"
|
||||||
// This file defines the interfaces for those dependencies as well as fake
|
// This file defines the interfaces for those dependencies as well as fake
|
||||||
// implementations that are useful in tests.
|
// implementations that are useful in tests.
|
||||||
|
|
||||||
// Interface for the core.Editor dependency.
|
// Interface for the clicore.Editor dependency.
|
||||||
type editor interface {
|
type editor interface {
|
||||||
notifier
|
notifier
|
||||||
State() *types.State
|
State() *types.State
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/elves/elvish/edit/history/histutil"
|
"github.com/elves/elvish/edit/history/histutil"
|
||||||
"github.com/elves/elvish/eval"
|
"github.com/elves/elvish/eval"
|
||||||
"github.com/elves/elvish/eval/vars"
|
"github.com/elves/elvish/eval/vars"
|
||||||
"github.com/elves/elvish/newedit/core"
|
"github.com/elves/elvish/newedit/clicore"
|
||||||
"github.com/elves/elvish/newedit/highlight"
|
"github.com/elves/elvish/newedit/highlight"
|
||||||
"github.com/elves/elvish/parse"
|
"github.com/elves/elvish/parse"
|
||||||
"github.com/elves/elvish/store/storedefs"
|
"github.com/elves/elvish/store/storedefs"
|
||||||
|
@ -20,13 +20,13 @@ import (
|
||||||
//
|
//
|
||||||
// TODO: Rename ReadLine to ReadCode and remove Close.
|
// TODO: Rename ReadLine to ReadCode and remove Close.
|
||||||
type Editor struct {
|
type Editor struct {
|
||||||
core *core.Editor
|
core *clicore.Editor
|
||||||
ns eval.Ns
|
ns eval.Ns
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEditor creates a new editor from input and output terminal files.
|
// NewEditor creates a new editor from input and output terminal files.
|
||||||
func NewEditor(in, out *os.File, ev *eval.Evaler, st storedefs.Store) *Editor {
|
func NewEditor(in, out *os.File, ev *eval.Evaler, st storedefs.Store) *Editor {
|
||||||
ed := core.NewEditor(core.NewTTY(in, out), core.NewSignalSource())
|
ed := clicore.NewEditor(clicore.NewTTY(in, out), clicore.NewSignalSource())
|
||||||
|
|
||||||
ed.Highlighter = highlight.NewHighlighter(
|
ed.Highlighter = highlight.NewHighlighter(
|
||||||
highlight.Dep{Check: makeCheck(ev), HasCommand: makeHasCommand(ev)})
|
highlight.Dep{Check: makeCheck(ev), HasCommand: makeHasCommand(ev)})
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Package prompt provides an implementation of the core.Prompt interface.
|
// Package prompt provides an implementation of the clicore.Prompt interface.
|
||||||
package prompt
|
package prompt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -10,13 +10,13 @@ import (
|
||||||
"github.com/elves/elvish/eval"
|
"github.com/elves/elvish/eval"
|
||||||
"github.com/elves/elvish/eval/vals"
|
"github.com/elves/elvish/eval/vals"
|
||||||
"github.com/elves/elvish/eval/vars"
|
"github.com/elves/elvish/eval/vars"
|
||||||
"github.com/elves/elvish/newedit/core"
|
"github.com/elves/elvish/newedit/clicore"
|
||||||
"github.com/elves/elvish/newedit/prompt"
|
"github.com/elves/elvish/newedit/prompt"
|
||||||
"github.com/elves/elvish/styled"
|
"github.com/elves/elvish/styled"
|
||||||
"github.com/elves/elvish/util"
|
"github.com/elves/elvish/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
func makePrompt(nt notifier, ev *eval.Evaler, ns eval.Ns, computeInit eval.Callable, name string) core.Prompt {
|
func makePrompt(nt notifier, ev *eval.Evaler, ns eval.Ns, computeInit eval.Callable, name string) clicore.Prompt {
|
||||||
compute := computeInit
|
compute := computeInit
|
||||||
ns[name] = vars.FromPtr(&compute)
|
ns[name] = vars.FromPtr(&compute)
|
||||||
return prompt.New(func() styled.Text {
|
return prompt.New(func() styled.Text {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user