Documentation ¶
Index ¶
- type Acme
- type AcmeOp
- type ActionOrigin
- type ActionType
- type Buf
- type BufListener
- type Condition
- type Event
- type Flag
- type KeyCmdHandler
- type KeyCmdHook
- type Listener
- type PutHandler
- type PutHook
- type Win
- func (w *Win) ClearTagText() error
- func (w *Win) Close()
- func (w *Win) DisableNoMark() error
- func (w *Win) EnableNoMark() error
- func (w *Win) ExecDelete() error
- func (w *Win) ExecDumpToFile(file string) error
- func (w *Win) ExecGet() error
- func (w *Win) ExecInTag(exec string, args ...string) error
- func (w *Win) ExecPut() error
- func (w *Win) ExecShow() error
- func (w *Win) MarkWinClean() error
- func (w *Win) MarkWinDirty() error
- func (w *Win) OpenEventChan() <-chan *acme.Event
- func (w *Win) ReadAddr() ([]byte, error)
- func (w *Win) ReadBody() ([]byte, error)
- func (w *Win) ReadTag() ([]byte, error)
- func (w *Win) RestrictSearchToAddr() error
- func (w *Win) SetAddr(addr string) error
- func (w *Win) SetAddrToSelText() error
- func (w *Win) SetData(data []byte) error
- func (w *Win) SetDumpDir(dir string) error
- func (w *Win) SetTextToAddr() error
- func (w *Win) SetWinName(name string) error
- func (w *Win) WriteEvent(e Event) error
- func (w *Win) WriteToTag(text string) error
- type WinHandler
- type WinHook
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acme ¶
type Acme struct {
// contains filtered or unexported fields
}
Acme implements the Listener interface for acme events
func (*Acme) GetBufListener ¶
GetBufListener returns the running Buf by its ID
func (*Acme) Listen ¶
Listen watches the acme event log for events and executes hooks based on those events
func (*Acme) RegisterKeyCmdHook ¶
func (a *Acme) RegisterKeyCmdHook(hook KeyCmdHook)
RegisterKeyCmdHook registers hook for key events
func (*Acme) RegisterPutHook ¶
RegisterPutHook registers hook on acme 'Put' events
func (*Acme) RegisterWinHook ¶
RegisterWinHook registers the hook on acme 'New' events
type ActionOrigin ¶
type ActionOrigin int
ActionOrigin is the entity that originated the action
const ( // BodyOrTag represents an action received in the body or tag BodyOrTag ActionOrigin = iota // WindowFiles represents an action taken in the file WindowFiles // Keyboard represents an action taken by the keyboard Keyboard // Mouse represents an action taken by the mouse Mouse // DelOrigin represents a delete event DelOrigin )
type ActionType ¶
type ActionType int
ActionType describes what kind of action was taken
const ( // BodyDelete is a deletion in the window body BodyDelete ActionType = iota // TagDelete is a deletion in the window tag TagDelete // BodyInsert is an insertion into the window body BodyInsert // TagInsert is an insert into the window tag TagInsert // B3Body is a right click event in the window body B3Body // B3Tag is a right click event in the window tag B3Tag // B2Body is a middle click event in the window body B2Body // B2Tag is a middle click event in the window tag B2Tag // DelType represents a delete event DelType )
type Buf ¶
Buf implements the BufListener interface and runs on opened acme buffers
func (*Buf) RegisterKeyCmdHook ¶
func (b *Buf) RegisterKeyCmdHook(hook KeyCmdHook)
RegisterKeyCmdHook registers hook for key events
func (*Buf) RegisterPutHook ¶
RegisterPutHook registers hook on acme 'Put' events
func (*Buf) RegisterWinHook ¶
RegisterWinHook registers the hook on acme 'New' events
type BufListener ¶
type BufListener interface { GetWin() *Win Start() error RegisterPutHook(hook PutHook) RegisterWinHook(hook WinHook) RegisterKeyCmdHook(KeyCmdHook) }
BufListener processes hooks on acme events
func NewBufListener ¶
func NewBufListener(id int, file string) BufListener
NewBufListener constructs an event loop
type Event ¶
type Event struct { ID int File string Origin ActionOrigin Type ActionType Text []byte Builtin AcmeOp Flag Flag SelBegin, SelEnd int OrigSelBegin, OrigSelEnd int NumBytes int NumRunes int ChordArg []byte ChordLoc []byte }
Event contains metadata for each Acme event
The message includes the text if it is less than 256 chars. If it is longer than that, the fourth number is 0 and the body must be read through the data file
func TokenizeEvent ¶
TokenizeEvent parses a raw acme event into the Event type
type Flag ¶
type Flag int
Flag contains the flag for the event. For BodyDelete, TagDelete, BodyInsert, and TagInsert the flag is always zero. For messages with the 1 bit on in the flag, writing the message back to the event file, but with the flag, count, and text omitted, will cause the action to be applied to the file exactly as it would have been if the event file had not been open.
const ( // IsBuiltin represents a built-in command IsBuiltin Flag = iota // IsNull represents if the text is a null string that has a // non-null expansion; if so, another complete message will // follow describing the expansion exactly as if it had been // indicated explicitly (its flag will always be 0) IsNull // HasChordedArg says if the command has an extra (chorded) // argument; if so, two more complete messages will follow // reporting the argument (with all numbers 0 except the // character count) and where it originated, in the form of a // fully-qualified button 3 style address. HasChordedArg // NoReloadNeeded says if acme can interpret the action without // loading a new file NoReloadNeeded // PostExpandFollows says if a second (post-expansion) message // follows, analogous to that with X messages PostExpandFollows // IsFileOrWindow says If the text is a file or window name // (perhaps with address) rather than plain literal text. IsFileOrWindow )
type KeyCmdHook ¶
type KeyCmdHook struct { Key rune Condition Condition Handler KeyCmdHandler }
KeyCmdHook contains properties for key handlers
type Listener ¶
type Listener interface { Listen() error RegisterPutHook(hook PutHook) RegisterWinHook(hook WinHook) RegisterKeyCmdHook(KeyCmdHook) GetBufListener(id int) *Buf }
Listener can listen for acme Event and Window hooks
type PutHook ¶
type PutHook struct {
Handler PutHandler
}
PutHook contains properties for event handlers
type Win ¶
Win represents the active Acme window
func (*Win) ClearTagText ¶
ClearTagText removes all text in the tag after the vertical bar.
func (*Win) DisableNoMark ¶
DisableNoMark cancels nomark, returning the window to the usual state wherein each modification to the body must be undone individually.
func (*Win) EnableNoMark ¶
EnableNoMark turns off automatic ‘marking’ of changes, so a set of related changes may be undone in a single Undo interactive command.
func (*Win) ExecDelete ¶
ExecDelete is the equivalent to the Del interactive command.
func (*Win) ExecDumpToFile ¶
ExecDumpToFile sets the command string to recreate the window from a dump file.
func (*Win) ExecGet ¶
ExecGet is the equivalent to the Get interactive command with no arguments; accepts no arguments.
func (*Win) ExecPut ¶
ExecPut is the equivalent to the Put interactive command with no arguments; accepts no arguments.
func (*Win) ExecShow ¶
ExecShow guarantees at least some of the selected text is visible on the display.
func (*Win) MarkWinClean ¶
MarkWinClean marks the window clean as though it has just been written.
func (*Win) MarkWinDirty ¶
MarkWinDirty marks the window dirty, the opposite of clean.
func (*Win) OpenEventChan ¶
OpenEventChan opens a channel to raw acme events
func (*Win) RestrictSearchToAddr ¶
RestrictSearchToAddr restricts subsequent searches to the current addr address.
func (*Win) SetAddr ¶
SetAddr takes an addr which may be written with any textual address in the format understood by button 3 but without the initial colon
func (*Win) SetAddrToSelText ¶
SetAddrToSelText sets the addr address to that of the user’s selected text in the window.
func (*Win) SetData ¶
SetData is used in conjunction with addr for random access to the contents of the body. The file offset is ignored when writing the data file; instead the location of the data to be read or written is determined by the state of the addr file. Text, which must contain only whole characters (no ‘partial runes’), written to data replaces the characters addressed by the addr file and sets the address to the null string at the end of the written text. A read from data returns as many whole characters as the read count will permit starting at the beginning of the addr address (the end of the address has no effect) and sets the address to the null string at the end of the returned characters.
func (*Win) SetDumpDir ¶
SetDumpDir sets the directory in which to run the command to recreate the window from a dump file.
func (*Win) SetTextToAddr ¶
SetTextToAddr sets the user’s selected text in the window to the text addressed by the addr address.
func (*Win) SetWinName ¶
SetWinName sets the name of the window to name.
func (*Win) WriteEvent ¶
WriteEvent writes the acme event to the log
func (*Win) WriteToTag ¶
WriteToTag writes to the windows tag
type WinHook ¶
type WinHook struct {
Handler WinHandler
}
WinHook contains properties for window handlers