Documentation ¶
Overview ¶
Package edit implements a command line editor.
Index ¶
Constants ¶
const ( S_IWOTH = 0x2 // Writable by other S_IXGRP = 0x8 // Executable by group S_IXOTH = 0x1 // Executable by other )
Weirdly, permission masks for group and other are missing on platforms other than linux, darwin and netbsd. So we replicate some of them here.
const PreviewBytes = 64 * 1024
PreviewBytes is the maximum number of bytes to preview a file.
Variables ¶
var ( // ErrCompleterMustBeFn is thrown if the user has put a non-function entry // in $edit:completer, and that entry needs to be used for completion. // TODO(xiaq): Detect the type violation when the user modifies // $edit:completer. ErrCompleterMustBeFn = errors.New("completer must be fn") // ErrCompleterArgMustBeString is thrown when a builtin argument completer // is called with non-string arguments. ErrCompleterArgMustBeString = errors.New("arguments to arg completers must be string") // ErrTooFewArguments is thrown when a builtin argument completer is called // with too few arguments. ErrTooFewArguments = errors.New("too few arguments") )
var ( ErrNotRegular = errors.New("no preview for non-regular file") ErrNotValidUTF8 = errors.New("no preview for non-utf8 file") )
Errors displayed in the preview area.
var ErrStoreOffline = errors.New("store offline")
ErrStoreOffline is thrown when an operation requires the storage backend, but it is offline.
var PinnedScore = math.Inf(1)
PinnedScore is a special value of Score in storedefs.Dir to represent that the directory is pinned.
Functions ¶
This section is empty.
Types ¶
type BindingTable ¶
type BindingTable struct {
// contains filtered or unexported fields
}
BindingTable adapts a binding table to eval.IndexSetter, so that it can be manipulated in elvish script.
func (BindingTable) IndexOne ¶
func (bt BindingTable) IndexOne(idx eval.Value) eval.Value
IndexOne returns the value with the specified map key. The map key is first converted into an internal Key struct.
func (BindingTable) IndexSet ¶
func (bt BindingTable) IndexSet(idx, v eval.Value)
IndexSet sets the value with the specified map key. The map key is first converted into an internal Key struct. The set value must be a callable one, otherwise an error is thrown.
func (BindingTable) Repr ¶
func (bt BindingTable) Repr(indent int) string
Repr returns the representation of the binding table as if it were an ordinary map.
type BuiltinFn ¶ added in v0.4.0
type BuiltinFn struct {
// contains filtered or unexported fields
}
BuiltinFn records an editor builtin.
type CursorOnModeLiner ¶ added in v0.6.0
type CursorOnModeLiner interface {
CursorOnModeLine() bool
}
CursorOnModeLiner is an optional interface that modes can implement. If a mode does and the method returns true, the cursor is placed on the modeline when that mode is active.
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor keeps the status of the line editor.
func NewEditor ¶
func NewEditor(in *os.File, out *os.File, sigs chan os.Signal, ev *eval.Evaler, daemon *api.Client) *Editor
NewEditor creates an Editor.
func (*Editor) ActiveMutex ¶ added in v0.4.0
ActiveMutex returns a mutex that must be used when changing the activeness of the Editor.
func (*Editor) CallFn ¶ added in v0.3.0
func (ed *Editor) CallFn(fn eval.CallableValue, args ...eval.Value)
CallFn calls an Fn, displaying its outputs and possible errors as editor notifications. It is the preferred way to call a Fn while the editor is active.
type History ¶ added in v0.3.0
type History struct {
// contains filtered or unexported fields
}
History implements the $le:history variable. It is list-like.
type ListRenderer ¶ added in v0.6.0
type ListRenderer interface { // ListRender renders the listing under the given constraint of width and // maximum height. It returns a rendered buffer. ListRender(width, maxHeight int) *buffer }
ListRenderer is a mode with a listing that handles the rendering itself. NOTE(xiaq): This interface is being deprecated in favor of Lister.
type Lister ¶
type Lister interface {
List(maxHeight int) renderer
}
Lister is a mode with a listing.
type Mode ¶
type Mode interface { ModeLine() renderer Binding(ui.Key) eval.CallableValue }
Mode is an editor mode.
type Placeholderer ¶ added in v0.2.0
type Placeholderer interface {
Placeholder() string
}
Notes ¶
Bugs ¶
after calling extendRight, the widths of some lines can exceed b.width.
Source Files ¶
- abbr.go
- action.go
- api.go
- api_utils.go
- arg_completers.go
- binding.go
- buffer.go
- candidate.go
- compl_getopt.go
- completers.go
- completion.go
- distribute_width.go
- dump_buf.go
- editor.go
- highlight.go
- histlist.go
- history.go
- history_value.go
- hooks.go
- insert.go
- lastcmd.go
- listing.go
- location.go
- ls_colors.go
- ls_colors_string.go
- matcher.go
- minmax.go
- mode.go
- navigation.go
- nodeutil.go
- prompt.go
- raw_insert.go
- registry.go
- render.go
- style.go
- styled.go
- writer.go
Directories ¶
Path | Synopsis |
---|---|
Package history provides utilities for the command history.
|
Package history provides utilities for the command history. |
Package ui contains types that may be used by different editor frontends.
|
Package ui contains types that may be used by different editor frontends. |