Documentation ¶
Overview ¶
Package eddefs contains types used in the Editor. It is separate package so that editor plugins do not need to depend on the edit package.
Index ¶
- Variables
- func MakeBindingMapCallable() eval.CustomCallable
- func TestListingProviderFilter(name string, ls ListingProvider, testcases []ListingProviderFilterTest) error
- type Action
- type BindingMap
- func (bt BindingMap) Assoc(k, v interface{}) (interface{}, error)
- func (bt BindingMap) Dissoc(k interface{}) interface{}
- func (bt BindingMap) GetKey(k ui.Key) eval.Callable
- func (bt BindingMap) GetOrDefault(k ui.Key) eval.Callable
- func (bt BindingMap) HasKey(k interface{}) bool
- func (bt BindingMap) Index(index interface{}) (interface{}, error)
- func (bt BindingMap) Repr(indent int) string
- type Editor
- type ListingProvider
- type ListingProviderFilterTest
- type ListingShown
- type Mode
- type Prompt
Constants ¶
This section is empty.
Variables ¶
var EmptyBindingMap = BindingMap{vals.EmptyMap}
Functions ¶
func MakeBindingMapCallable ¶
func MakeBindingMapCallable() eval.CustomCallable
MakeBindingMapCallable implements eval.CustomCallable interface for makeBindingMap.
func TestListingProviderFilter ¶
func TestListingProviderFilter(name string, ls ListingProvider, testcases []ListingProviderFilterTest) error
Types ¶
type Action ¶
type Action int
Action is used in the SetAction method of the Editor to schedule a special Action after a keybinding has been executed.
type BindingMap ¶
BindingMap is a special Map that converts its key to ui.Key and ensures that its values satisfy eval.CallableValue.
func (BindingMap) Assoc ¶
func (bt BindingMap) Assoc(k, v interface{}) (interface{}, error)
Assoc converts the index to ui.Key, ensures that the value is CallableValue, uses the Assoc of the inner Map and converts the result to a BindingTable.
func (BindingMap) Dissoc ¶
func (bt BindingMap) Dissoc(k interface{}) interface{}
Dissoc converts the key to ui.Key and calls the Dissoc method of the inner map.
func (BindingMap) GetOrDefault ¶
func (bt BindingMap) GetOrDefault(k ui.Key) eval.Callable
func (BindingMap) HasKey ¶
func (bt BindingMap) HasKey(k interface{}) bool
func (BindingMap) Index ¶
func (bt BindingMap) Index(index interface{}) (interface{}, error)
Index converts the index to ui.Key and uses the Index of the inner Map.
func (BindingMap) Repr ¶
func (bt BindingMap) Repr(indent int) string
Repr returns the representation of the binding table as if it were an ordinary map keyed by strings.
type Editor ¶
type Editor interface { // ReadLine reads a line interactively. ReadLine() (string, error) // Close releases resources used by the editor. Close() // Evaler returns the Evaler associated with the Editor. Evaler() *eval.Evaler // Buffer returns the current content and dot position of the buffer. Buffer() (string, int) // SetBuffer sets the current content and dot position of the buffer. SetBuffer(buffer string, dot int) // ParsedBuffer returns the node from parsing the buffer. ParsedBuffer() *parse.Chunk // InsertAtDot inserts text at the dot and moves the dot after it. InsertAtDot(text string) // SetPrompt sets the prompt of the editor. SetPrompt(prompt Prompt) // SetPrompt sets the rprompt of the editor. SetRPrompt(rprompt Prompt) // SetMode sets the current mode of the Editor. SetMode(m Mode) // SetModeInsert sets the current mode of the Editor to insert mode. SetModeInsert() // SetModeListing sets the current mode of the Editor to listing mode with // the supplied binding and provider. SetModeListing(b BindingMap, p ListingProvider) // RefreshListing refreshes the listing mode, recalculating the listing // items. It is useful when the underlying listing provider has been // changed. If the editor is not in listing mode, it does nothing. RefreshListing() // AddTip adds a message to the tip area. AddTip(format string, args ...interface{}) // Notify writes out a message in a way that does not interrupt the editor // display. When the editor is not active, it simply writes the message to // the terminal. When the editor is active, it appends the message to the // notification queue, which will be written out during the update cycle. It // can be safely used concurrently. Notify(format string, args ...interface{}) // LastKey returns the last key received from the user. It is useful mainly // in keybindings. LastKey() ui.Key // SetAction sets the action to execute after the key binding has finished. SetAction(a Action) // AddAfterReadline adds a hook function that runs after readline ends. AddAfterReadline(func(string)) }
Editor is the interface for the Elvish line editor.
type ListingProvider ¶
type ListingProviderFilterTest ¶
type ListingProviderFilterTest struct { Filter string WantShowns []ListingShown }
type ListingShown ¶
type Prompt ¶
type Prompt interface { // Chan returns a prompt on which the content of the prompt is made // available. Chan() <-chan []*ui.Styled // Update signifies that the prompt should be updated. Update(force bool) // Last returns the last content written to Chan. If Chan was never written, // it should return some content representing an unknown prompt. Last() []*ui.Styled // Close releases resources associated with the prompt. Close() error }
Prompt is the interface for a general prompt.