backend

package
v0.0.0-...-a7e8193 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2017 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

package backend provides the backend implementations of the goed editor text buffers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BufferFile

func BufferFile(id int64) string

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) ColorAt

func (b *BackendCmd) ColorAt(ln, col int) (fg, bg core.Style)

func (*BackendCmd) Head

func (b *BackendCmd) Head() int

func (*BackendCmd) Insert

func (b *BackendCmd) Insert(row, col int, text string) error

func (*BackendCmd) OnActivate

func (c *BackendCmd) OnActivate()

func (*BackendCmd) Overwrite

func (b *BackendCmd) Overwrite(row, col int, text string, fg, bg core.Style) (atRow, atCol int)

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) Slice

func (b *BackendCmd) Slice(row, col, row2, col2 int) *core.Slice

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) ColorAt

func (f *FileBackend) ColorAt(ln, col int) (fg, bg core.Style)

func (*FileBackend) Insert

func (f *FileBackend) Insert(row, col int, text string) 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) ColorAt

func (m *MemBackend) ColorAt(ln, col int) (fg, bg core.Style)

func (*MemBackend) Insert

func (b *MemBackend) Insert(row, col int, text string) 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) Slice

func (b *MemBackend) Slice(row, col, row2, col2 int) *core.Slice

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

Jump to

Keyboard shortcuts

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