Documentation ¶
Overview ¶
This file is part of goacme
Copyright (c) 2013, 2014, 2020 Alexander Sychev. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- The name of author may not be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Package goacme provides interface to acme programming environment
Index ¶
- Variables
- func DeleteAll()
- type ActionOrigin
- type ActionType
- type Event
- type Info
- type Infos
- type Log
- type LogEvent
- type OperationType
- type Window
- func (this *Window) Close() error
- func (this *Window) Del(sure bool) error
- func (this *Window) EventChannel(size int, tmask ActionType) (<-chan *Event, error)
- func (this *Window) File(file string) (io.ReadWriteSeeker, error)
- func (this *Window) Read(p []byte) (int, error)
- func (this *Window) ReadAddr() (begin int, end int, err error)
- func (this *Window) ReadCtl() (id int, tlen int, blen int, isdir bool, isdirty bool, wwidth int, font string, ...)
- func (this *Window) ReadEvent() (*Event, error)
- func (this *Window) Seek(offset int64, whence int) (ret int64, err error)
- func (this *Window) UnreadEvent(ev *Event) error
- func (this *Window) Write(p []byte) (int, error)
- func (this *Window) WriteAddr(format string, args ...interface{}) error
- func (this *Window) WriteCtl(format string, args ...interface{}) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidOrigin will be returned if a case of an unexpected origin of action ErrInvalidOrigin = errors.New("invalid origin of action") // ErrInvalidType will be returned if a case of an unexpected type of action ErrInvalidType = errors.New("invalid type of action") // ErrChannelAlreadyOpened will be returned // if channel of events is opened by call of EventChannel ErrChannelAlreadyOpened = errors.New("channel of events is already opened") )
Functions ¶
Types ¶
type ActionOrigin ¶
type ActionOrigin int
ActionOrigin is a origin of the action
const ( Unknown ActionOrigin = 0 // Edit is the origin for writes to the body or tag file Edit ActionOrigin = 1 << iota // File is the origin for through the window's other files File // Keyboard is the origin for keyboard actions Keyboard // Mouse is the origin for mouse actions Mouse )
type Event ¶
type Event struct { // Origin will be an origin of action with type ActionOrigin Origin ActionOrigin // Type will be an type of action with type ActionType Type ActionType // Begin is a start address of a text of the action Begin int // End is an end address of the text of the action End int // IsBuiltin is a flag the action is recognised like an \.{Acme}'s builtin IsBuiltin bool // NoLoad is a flag of acme can interpret the action without loading a new file NoLoad bool // IsFile is a flag the Text is a file or window name IsFile bool // Text is a text arguments of the action, perhaps with address Text string // Arg is a text of chorded argument if any Arg string // contains filtered or unexported fields }
type Infos ¶
type Infos []*Info
func WindowsInfo ¶
WindowsInfo returns a list of the existing acme windows.
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func (*Log) EventChannel ¶
func (this *Log) EventChannel(tmask OperationType) (<-chan *LogEvent, error)
EventChannel returns a channel of *LogEvent from which log events can be read or error. Only OperationType set in tmask are used. First call of EventChannel starts a goroutine to read events from the log and put them to the channel. Subsequent calls of EventChannel will return the same channel.
type LogEvent ¶
type LogEvent struct { Id int Type OperationType Name string }
type OperationType ¶
type OperationType int
OperationType is a type of the operation
const ( NewWin OperationType = 1 << iota Zerox Get Put DelWin Focus )
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is a structure to manipulate a particular acme's window.
func (*Window) EventChannel ¶
func (this *Window) EventChannel(size int, tmask ActionType) (<-chan *Event, error)
EventChannel returns a channel of *Event with a buffer size from which events can be read or error. Only ActionTypes set in tmask are used. If TagMask is set in tmask, the event will be masked by tag. Otherwise Tag flag will be ignored. First call of EventChannel starts a goroutine to read events from "event" file and put them to the channel. Subsequent calls of EventChannel will return the same channel.
func (*Window) File ¶
func (this *Window) File(file string) (io.ReadWriteSeeker, error)
File returns io.ReadWriteSeeker of corresponding file of the windows or error
func (*Window) Read ¶
Read reads len(p) bytes from "body" file of the window. Read returns a count of read bytes or error.
func (*Window) ReadAddr ¶
ReadAddr reads the address of the next read/write operation from "addr" file of the window. ReadAddr return begin and end offsets in symbols or error
func (*Window) ReadCtl ¶
func (this *Window) ReadCtl() (id int, tlen int, blen int, isdir bool, isdirty bool, wwidth int, font string, twidth int, err error)
ReadCtl reads the address of the next read/write operation from "ctl" file of the window. ReadCtl returns:
id - the window ID tlen - number of characters (runes) in the tag; blen - number of characters in the body; isdir - true if the window is a directory, false otherwise; isdirty - true if the window is modified, false otherwise; wwidth - the width of the window in pixels; font - the name of the font used in the window; twidth - the width of a tab character in pixels; error - in case of any error.
func (*Window) ReadEvent ¶
reads an event from "event" file of the window and returns *Event or error
func (*Window) Seek ¶
Seek sets a position for the next Read or Write to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. Seek returns the new offset or error
func (*Window) UnreadEvent ¶
UnreadEvent writes event ev back to the "event" file, indicating to acme that it should be handled internally.
func (*Window) Write ¶
Write writes len(p) bytes to "body" file of the window. Write returns a count of written bytes or error.