Documentation
¶
Index ¶
- func Namespace() (string, error)
- func Plumb(src, dest, wdir, data string) error
- func PlumbCmd(dir string, s string) error
- type Acme
- type EType
- type Event
- type EventStream
- type Origin
- type WinParams
- type Window
- func (w *Window) Addr() (q0 int, q1 int, err error)
- func (w *Window) AppendTag(s string) error
- func (w *Window) Body() (io.ReadWriter, error)
- func (w *Window) Close() error
- func (w *Window) Ctl(msg string) error
- func (w *Window) Events() (*EventStream, error)
- func (w *Window) LineNumber() (l0 int, l1 int, err error)
- func (w *Window) ReadCtl() (WinParams, error)
- func (w *Window) Selected() (string, error)
- func (w *Window) Tag() (string, error)
- func (w *Window) WriteAddr(a string) error
- func (w *Window) XData() (io.ReadWriteCloser, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Namespace ¶
Namespace duplicates plan9port's getns behavior, returning the local namespace directory where plan9 services may be posted.
Types ¶
type Acme ¶
type Acme struct {
// contains filtered or unexported fields
}
Acme represents a connection to an Acme/Edwood instance.
func NewAcme ¶
NewAcme creates a connection to a running Acme/Edwood instance by looking for the service `acme` in the current namespace (See: Namespace()).
type EType ¶
type EType int
EType is the type of an event.
type Event ¶
type Event struct { Origin Origin Type EType StartAddr int EndAddr int Flag int NChars int S string }
Event is something that happens in a window. This includes insertions, deletions, keypresses, clicks, etc.
func (*Event) Chorded ¶
Chorded reports whether the event represents a chorded command. If so, 2 more events should follow reporting the argument: The first will contain only the character count, and the second will contain where it originated, in the form of a fully-qualified button 3 style address.
func (*Event) HasExpansion ¶
HasExpansion reports whether this event has an expansion, meaning there will be another message following that contains the expanded text.
For example, a single button-2 click on Look will send an event with S=="" and HasExpansion() == true followed by another event with S == "Look" and HasExpansion() == false.
func (*Event) IsBuiltin ¶
IsBuiltin reports whether an event has a built-in implementation of the command. This can be used to determine if WriteBack() can be used to execute the event. This includes built-in commands like Del, Put, Get, etc. This is only true if acme can execute the event without loading a new file.
type EventStream ¶
type EventStream struct { C chan *Event // contains filtered or unexported fields }
EventStream represents a stream of events from a Window. These events are read from the window's `event` file. Events should be read from the chan C.
func (*EventStream) Close ¶
func (e *EventStream) Close() error
Close closes the event stream, returning control of the window to Acme.
func (*EventStream) WriteBack ¶
func (e *EventStream) WriteBack(ev *Event) error
This causes the event to be written back to the event file, according to acme(4).
For events where IsBuiltin() == true, writing the message back will cause the action to be applied to the file exactly as it would have been if the event file had not been open.
type Origin ¶
type Origin int
Origin is used to identify the source of an Event.
type WinParams ¶
type WinParams struct { ID int // The Window's ID TagChars int // The number of characters in the tag BodyChars int // The number of characters in the body Dir bool // True if the window is a directory Modified bool // True if the window has been modified }
WinParams represents the 5 parameters read from the Window's ctl file.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents an Acme window
func (*Window) Addr ¶
Addr reads the window's addr file and returns the value of the address that would next be read or written through the data file in the format of 2 character (not byte) offsets. (See: acme(4))
func (*Window) Body ¶
func (w *Window) Body() (io.ReadWriter, error)
Body returns the window's body file.
func (*Window) Ctl ¶
Ctl writes a message to the Window's ctl file. Ctl will add a newline to the message. This can be used to control much of the window's state. See acme(4) for what messages can be written.
func (*Window) Events ¶
func (w *Window) Events() (*EventStream, error)
Events returns an EventStream which can be used by applications to handle window events. Please see EventStream and acme(4) for more details.
func (*Window) LineNumber ¶
LineNumber returns the start and end line numbers of the user's currently selected text.
func (*Window) ReadCtl ¶
ReadCtl reads the window's ctl file and returns the WinParams associated with the Window.