Documentation
¶
Overview ¶
package backend provides the backend implementations of the goed editor text buffers.
Index ¶
- func BufferFile(id int64) string
- type BackendCmd
- func (b *BackendCmd) Append(text string) error
- func (b *BackendCmd) BufferLoc() string
- func (b *BackendCmd) Close() error
- func (b *BackendCmd) ColorAt(ln, col int) (fg, bg core.Style)
- func (b *BackendCmd) Head() int
- func (b *BackendCmd) Insert(row, col int, text string) error
- func (c *BackendCmd) OnActivate()
- func (b *BackendCmd) Overwrite(row, col int, text string, fg, bg core.Style) (atRow, atCol int)
- func (c *BackendCmd) Reload() error
- func (b *BackendCmd) Remove(row1, col1, row2, col2 int) error
- func (b *BackendCmd) Running() bool
- func (b *BackendCmd) Save(loc string) error
- func (b *BackendCmd) SendBytes(data []byte)
- func (b *BackendCmd) Slice(row, col, row2, col2 int) *core.Slice
- func (b *BackendCmd) SrcLoc() string
- func (c *BackendCmd) Start(viewId int64)
- func (c *BackendCmd) SubCmdRunning() bool
- func (c *BackendCmd) WaitRunning(t time.Duration) bool
- func (b *BackendCmd) Wipe()
- type CmdStarter
- type FileBackend
- func (f *FileBackend) Append(text string) error
- func (f *FileBackend) BufferLoc() string
- func (f *FileBackend) Close() error
- func (f *FileBackend) ColorAt(ln, col int) (fg, bg core.Style)
- func (f *FileBackend) Insert(row, col int, text string) error
- func (f *FileBackend) LineCount() int
- func (b *FileBackend) OffsetAt(ln, col int) int64
- func (b *FileBackend) OnActivate()
- func (b *FileBackend) Reload() error
- func (f *FileBackend) Remove(row1, col1, row2, col2 int) error
- func (f *FileBackend) Save(loc string) error
- func (b *FileBackend) SendBytes(data []byte)
- func (b *FileBackend) SetVtCols(cols int)
- func (f *FileBackend) Slice(line1, col, line2, col2 int) *core.Slice
- func (f *FileBackend) SrcLoc() string
- func (f *FileBackend) ViewId() int64
- func (f *FileBackend) Wipe()
- type MemBackend
- func (b *MemBackend) Append(text string) error
- func (b *MemBackend) BufferLoc() string
- func (b *MemBackend) Close() error
- func (m *MemBackend) ColorAt(ln, col int) (fg, bg core.Style)
- func (b *MemBackend) Insert(row, col int, text string) error
- func (b *MemBackend) LineCount() int
- func (b *MemBackend) OffsetAt(ln, col int) int64
- func (m *MemBackend) OnActivate()
- func (m *MemBackend) Reload() error
- func (b *MemBackend) Remove(row1, col1, row2, col2 int) error
- func (b *MemBackend) Save(loc string) error
- func (m *MemBackend) SendBytes(data []byte)
- func (m *MemBackend) SetVtCols(cols int)
- func (b *MemBackend) Slice(row, col, row2, col2 int) *core.Slice
- func (b *MemBackend) SrcLoc() string
- func (b *MemBackend) ViewId() int64
- func (b *MemBackend) Wipe()
- type MemCmdStarter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BufferFile ¶
Types ¶
type BackendCmd ¶
type BackendCmd struct { *MemBackend Starter CmdStarter MaxRows int // ring buffer size // contains filtered or unexported fields }
BackendCmd is used to run a command using a specific backend whose content will be the the output of the command. (VT100 support)
func NewMemBackendCmd ¶
func NewMemBackendCmd(args []string, dir string, viewId int64, title *string, scrollTop bool) (*BackendCmd, error)
NewMemBackendCmd creates a Command runner backed by an In-memory based backend if title == nil then will show the command name
func (*BackendCmd) Append ¶
func (b *BackendCmd) Append(text string) error
func (*BackendCmd) BufferLoc ¶
func (b *BackendCmd) BufferLoc() string
func (*BackendCmd) Close ¶
func (b *BackendCmd) Close() error
func (*BackendCmd) Head ¶
func (b *BackendCmd) Head() int
func (*BackendCmd) OnActivate ¶
func (c *BackendCmd) OnActivate()
func (*BackendCmd) Reload ¶
func (c *BackendCmd) Reload() error
func (*BackendCmd) Remove ¶
func (b *BackendCmd) Remove(row1, col1, row2, col2 int) error
func (*BackendCmd) Running ¶
func (b *BackendCmd) Running() bool
func (*BackendCmd) Save ¶
func (b *BackendCmd) Save(loc string) error
func (*BackendCmd) SendBytes ¶
func (b *BackendCmd) SendBytes(data []byte)
func (*BackendCmd) SrcLoc ¶
func (b *BackendCmd) SrcLoc() string
func (*BackendCmd) Start ¶
func (c *BackendCmd) Start(viewId int64)
func (*BackendCmd) SubCmdRunning ¶
func (c *BackendCmd) SubCmdRunning() bool
check if the shell is currently running any subcommands
func (*BackendCmd) WaitRunning ¶
func (c *BackendCmd) WaitRunning(t time.Duration) bool
func (*BackendCmd) Wipe ¶
func (b *BackendCmd) Wipe()
type CmdStarter ¶
type CmdStarter interface {
Start(c *BackendCmd) error
}
CmdStarter is an interface for a "startable" command
type FileBackend ¶
type FileBackend struct {
// contains filtered or unexported fields
}
FileBackend is a backend implemetation that uses a plain unbuffered file as its buffer.
func NewFileBackend ¶
func NewFileBackend(loc string, viewId int64) (*FileBackend, error)
NewFileBackend creates a backend from a copy of the file in the buffer dir. Note that very large files(>100Mb) might be edited in place.
func (*FileBackend) Append ¶
func (f *FileBackend) Append(text string) error
func (*FileBackend) BufferLoc ¶
func (f *FileBackend) BufferLoc() string
func (*FileBackend) Close ¶
func (f *FileBackend) Close() error
func (*FileBackend) LineCount ¶
func (f *FileBackend) LineCount() int
func (*FileBackend) OffsetAt ¶
func (b *FileBackend) OffsetAt(ln, col int) int64
func (*FileBackend) OnActivate ¶
func (b *FileBackend) OnActivate()
func (*FileBackend) Reload ¶
func (b *FileBackend) Reload() error
func (*FileBackend) Remove ¶
func (f *FileBackend) Remove(row1, col1, row2, col2 int) error
func (*FileBackend) Save ¶
func (f *FileBackend) Save(loc string) error
func (*FileBackend) SendBytes ¶
func (b *FileBackend) SendBytes(data []byte)
func (*FileBackend) SetVtCols ¶
func (b *FileBackend) SetVtCols(cols int)
func (*FileBackend) Slice ¶
func (f *FileBackend) Slice(line1, col, line2, col2 int) *core.Slice
Slice returns the runes that are in the given rectangle. line2 / col2 maybe -1, meaning all lines / whole lines
func (*FileBackend) SrcLoc ¶
func (f *FileBackend) SrcLoc() string
func (*FileBackend) ViewId ¶
func (f *FileBackend) ViewId() int64
func (*FileBackend) Wipe ¶
func (f *FileBackend) Wipe()
type MemBackend ¶
type MemBackend struct {
// contains filtered or unexported fields
}
MemBackend is a Backend implementation backed by an in memory bufer.
func NewMemBackend ¶
func NewMemBackend(loc string, viewId int64) (*MemBackend, error)
NewmemBackend creates a new in memory backend by reading a file.
func (*MemBackend) Append ¶
func (b *MemBackend) Append(text string) error
func (*MemBackend) BufferLoc ¶
func (b *MemBackend) BufferLoc() string
func (*MemBackend) Close ¶
func (b *MemBackend) Close() error
func (*MemBackend) LineCount ¶
func (b *MemBackend) LineCount() int
func (*MemBackend) OffsetAt ¶
func (b *MemBackend) OffsetAt(ln, col int) int64
func (*MemBackend) OnActivate ¶
func (m *MemBackend) OnActivate()
func (*MemBackend) Reload ¶
func (m *MemBackend) Reload() error
func (*MemBackend) Remove ¶
func (b *MemBackend) Remove(row1, col1, row2, col2 int) error
func (*MemBackend) Save ¶
func (b *MemBackend) Save(loc string) error
func (*MemBackend) SendBytes ¶
func (m *MemBackend) SendBytes(data []byte)
func (*MemBackend) SetVtCols ¶
func (m *MemBackend) SetVtCols(cols int)
func (*MemBackend) SrcLoc ¶
func (b *MemBackend) SrcLoc() string
func (*MemBackend) ViewId ¶
func (b *MemBackend) ViewId() int64
func (*MemBackend) Wipe ¶
func (b *MemBackend) Wipe()
type MemCmdStarter ¶
type MemCmdStarter struct { }
MemCmdStarter is the command starter implementation for mem backend It starts the command and "streams" the output to the backend.
func (*MemCmdStarter) Start ¶
func (s *MemCmdStarter) Start(c *BackendCmd) error