edit

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 28, 2017 License: BSD-2-Clause Imports: 29 Imported by: 0

Documentation

Overview

Package edit implements a command line editor.

Index

Constants

View Source
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.

View Source
const FileBufferSize = 64 * 1024

Variables

View Source
var (
	ErrCompleterMustBeFn        = errors.New("completer must be fn")
	ErrCompleterArgMustBeString = errors.New("arguments to arg completers must be string")
	ErrTooFewArguments          = errors.New("too few arguments")
)
View Source
var (
	ErrNotRegular   = errors.New("no preview for non-regular file")
	ErrNotValidUTF8 = errors.New("no preview for non-utf8 file")
)
View Source
var ErrStoreOffline = errors.New("store offline")
View Source
var PinnedScore = math.Inf(1)

PinnedScore is a special value of Score in store.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

func (BindingTable) IndexSet

func (bt BindingTable) IndexSet(idx, v eval.Value)

func (BindingTable) Kind

func (BindingTable) Kind() string

func (BindingTable) Repr

func (bt BindingTable) Repr(indent int) string

type BuiltinFn added in v0.4.0

type BuiltinFn struct {
	// contains filtered or unexported fields
}

BuiltinFn records an editor builtin.

func (*BuiltinFn) Call added in v0.4.0

func (bf *BuiltinFn) Call(ec *eval.EvalCtx, args []eval.Value, opts map[string]eval.Value)

func (*BuiltinFn) Kind added in v0.4.0

func (*BuiltinFn) Kind() string

func (*BuiltinFn) Repr added in v0.4.0

func (bf *BuiltinFn) Repr(int) string

type CursorOnModeLiner added in v0.6.0

type CursorOnModeLiner interface {
	CursorOnModeLine() bool
}

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, st *store.Store) *Editor

NewEditor creates an Editor.

func (*Editor) Active added in v0.4.0

func (ed *Editor) Active() bool

func (*Editor) ActiveMutex added in v0.4.0

func (ed *Editor) ActiveMutex() *sync.Mutex

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.

func (*Editor) Notify added in v0.4.0

func (ed *Editor) Notify(format string, args ...interface{})

func (*Editor) ReadLine

func (ed *Editor) ReadLine() (line string, err error)

ReadLine reads a line interactively.

type Highlighter added in v0.6.0

type Highlighter struct {
	// contains filtered or unexported fields
}

type History added in v0.3.0

type History struct {
	// contains filtered or unexported fields
}

func (History) IndexOne added in v0.3.0

func (hv History) IndexOne(idx eval.Value) eval.Value

func (History) Iterate added in v0.3.0

func (hv History) Iterate(f func(eval.Value) bool)

func (History) Kind added in v0.3.0

func (hv History) Kind() string

func (History) Len added in v0.3.0

func (hv History) Len() int

func (History) Repr added in v0.3.0

func (hv History) Repr(int) string

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.

type Lister

type Lister interface {
	List(maxHeight int) renderer
}

Lister is a mode with a listing.

type Mode

type Mode interface {
	Mode() ModeType
	ModeLine() renderer
}

Mode is an editor mode.

type ModeType

type ModeType int

type Placeholderer added in v0.2.0

type Placeholderer interface {
	Placeholder() string
}

type Pos added in v0.6.0

type Pos struct {
	// contains filtered or unexported fields
}

Pos is the position within a buffer.

type Writer added in v0.6.0

type Writer struct {
	// contains filtered or unexported fields
}

Writer renders the editor UI.

Notes

Bugs

  • after calling extendRight, the widths of some lines can exceed b.width.

Directories

Path Synopsis
Package ui contains types that may be used by different editor frontends.
Package ui contains types that may be used by different editor frontends.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL