Documentation
¶
Index ¶
- Constants
- Variables
- func CmdCarriageReturn(w *Window)
- func CmdCursorDown(w *Window)
- func CmdCursorLeft(w *Window)
- func CmdCursorRight(w *Window)
- func CmdCursorUp(w *Window)
- func CmdDeletePrevRune(w *Window)
- func CmdMoveToLineEnd(w *Window)
- func CmdMoveToLineStart(w *Window)
- func CmdPageDown(w *Window)
- func CmdPageUp(w *Window)
- func CmdQuit(w *Window)
- func CmdSaveBuffer(w *Window)
- func CmdScrollDown(w *Window)
- func CmdScrollUp(w *Window)
- type Action
- type ActionMaker
- type App
- func (a *App) BindEvents(name, seq string, f runtime.Value) error
- func (a *App) CommandInput()
- func (a *App) CopyToClipboard(s string) error
- func (a *App) Draw(screen *Screen)
- func (a *App) GetEventHandler(name string) *EventHandler
- func (a *App) HandleEvent(evt Event)
- func (a *App) InitLuaCode(initfile string, luaCode []byte) error
- func (a *App) InitLuaFile(initfile string) error
- func (a *App) Log(msg string)
- func (a *App) Logf(format string, args ...interface{})
- func (a *App) LuaActionMaker(f runtime.Value) ActionMaker
- func (a *App) Quit()
- func (a *App) Resize(w, h int)
- func (a *App) Running() bool
- func (a *App) SwitchWindow()
- func (a *App) UnbindEvents(name, seq string) error
- func (a *App) Write(p []byte) (int, error)
- type ArgType
- type Buffer
- type Command
- type CommandAction
- type Event
- type EventHandler
- type EventType
- type FileBuffer
- func (b *FileBuffer) AdvancePos(l, c, dl, dc int) (int, int)
- func (b *FileBuffer) AppendLine(line Line)
- func (b *FileBuffer) DeleteLine(l int) error
- func (b *FileBuffer) DeleteRuneAt(l, c int) error
- func (b *FileBuffer) EndPos() (int, int)
- func (b *FileBuffer) GetLine(l, c int) (Line, error)
- func (b *FileBuffer) InsertLine(l int, line Line) error
- func (b *FileBuffer) InsertRune(r rune, l, c int) error
- func (b *FileBuffer) InsertString(s string, l, c int) (int, int, error)
- func (b *FileBuffer) Kind() string
- func (b *FileBuffer) Line(l int) Line
- func (b *FileBuffer) LineCount() int
- func (b *FileBuffer) MergeLineWithPrevious(l int) error
- func (b *FileBuffer) NearestPos(l, c int) (int, int)
- func (b *FileBuffer) Save() error
- func (b *FileBuffer) SetLine(l int, line Line) error
- func (b *FileBuffer) SplitLine(l, c int) error
- func (b *FileBuffer) StringFromRegion(l0, c0, l1, c1 int) (string, error)
- func (b *FileBuffer) StyledLineIter(l, c int) StyledLineIter
- func (b *FileBuffer) Truncate(count int)
- type ILine
- type Invocation
- type KeyData
- type Line
- type LineIter
- type Modifiers
- type MouseButtons
- type MouseData
- type Parameter
- type Position
- type Printer
- type Rectangle
- type Screen
- func (s *Screen) Cleanup()
- func (s *Screen) Fill(c rune)
- func (s *Screen) PollEvent() Event
- func (s *Screen) Reverse(p Position)
- func (s *Screen) SetRune(p Position, c rune, style tcell.Style)
- func (s *Screen) Show()
- func (s *Screen) Size() Size
- func (s *Screen) SubScreen(rect Rectangle) ScreenWriter
- type ScreenWriter
- type Size
- type Style
- type StyledLineIter
- type SubScreen
- type TcellEventConverter
- type Window
- func (w *Window) App() *App
- func (w *Window) Buffer() Buffer
- func (w *Window) CurrentLine() (Line, error)
- func (w *Window) CursorLine() int
- func (w *Window) CursorPos() (int, int)
- func (w *Window) DeleteRune() (err error)
- func (w *Window) Draw(screen ScreenWriter)
- func (w *Window) DrawCursor(screen ScreenWriter)
- func (w *Window) FocusCursor(screen ScreenWriter)
- func (w *Window) GetHighlightedString() (string, error)
- func (w *Window) GetLineCol(x, y int) (int, int)
- func (w *Window) HandleEvent(evt Event) (Action, error)
- func (w *Window) InsertRune(r rune)
- func (w *Window) MoveCursor(dl, dc int)
- func (w *Window) MoveCursorTo(x, y int)
- func (w *Window) MoveCursorToEnd()
- func (w *Window) MoveCursorToLineEnd()
- func (w *Window) MoveCursorToLineStart()
- func (w *Window) MoveHighlightRegion(x, y int)
- func (w *Window) PageDown(n int)
- func (w *Window) PasteString(s string) (err error)
- func (w *Window) RegisterWithApp(app *App)
- func (w *Window) ResetHighlightRegion()
- func (w *Window) Resize(width, height int)
- func (w *Window) ScrollDown(n int)
- func (w *Window) ScrollUp(n int)
- func (w *Window) SplitLine(move bool) error
- func (w *Window) StartHighlightRegion(x, y int)
- func (w *Window) StopHightlightRegion(x, y int) bool
- func (w *Window) StyledLineIter(l, c int) StyledLineIter
Constants ¶
const ( ColorBlack = tcell.ColorBlack ColorMaroon = tcell.ColorMaroon ColorGreen = tcell.ColorGreen ColorOlive = tcell.ColorOlive ColorPurple = tcell.ColorPurple ColorTeal = tcell.ColorTeal ColorSilver = tcell.ColorSilver ColorGray = tcell.ColorGray ColorRed = tcell.ColorRed ColorLime = tcell.ColorLime ColorYellow = tcell.ColorYellow ColorBlue = tcell.ColorBlue ColorFuchsia = tcell.ColorFuchsia ColorAqua = tcell.ColorAqua ColorWhite = tcell.ColorWhite )
Variables ¶
var DefaultStyle = tcell.StyleDefault
Functions ¶
func CmdCarriageReturn ¶
func CmdCarriageReturn(w *Window)
func CmdCursorDown ¶
func CmdCursorDown(w *Window)
func CmdCursorLeft ¶
func CmdCursorLeft(w *Window)
func CmdCursorRight ¶
func CmdCursorRight(w *Window)
func CmdCursorUp ¶
func CmdCursorUp(w *Window)
func CmdDeletePrevRune ¶
func CmdDeletePrevRune(w *Window)
func CmdMoveToLineEnd ¶
func CmdMoveToLineEnd(w *Window)
func CmdMoveToLineStart ¶
func CmdMoveToLineStart(w *Window)
func CmdPageDown ¶
func CmdPageDown(w *Window)
func CmdSaveBuffer ¶
func CmdSaveBuffer(w *Window)
func CmdScrollDown ¶
func CmdScrollDown(w *Window)
func CmdScrollUp ¶
func CmdScrollUp(w *Window)
Types ¶
type Action ¶
type Action func(win *Window)
func CmdInsertRune ¶
func CmdMouseButtonUp ¶
func CmdMouseDrag ¶
func CmdMoveButtonDown ¶
func CmdPasteString ¶
type ActionMaker ¶
type ActionMaker func([]interface{}) Action
func SimpleActionMaker ¶
func SimpleActionMaker(f Action) ActionMaker
type App ¶
type App struct {
// contains filtered or unexported fields
}
func (*App) CommandInput ¶
func (a *App) CommandInput()
func (*App) CopyToClipboard ¶
func (*App) GetEventHandler ¶
func (a *App) GetEventHandler(name string) *EventHandler
func (*App) HandleEvent ¶
func (*App) InitLuaFile ¶
func (*App) LuaActionMaker ¶
func (a *App) LuaActionMaker(f runtime.Value) ActionMaker
func (*App) SwitchWindow ¶
func (a *App) SwitchWindow()
func (*App) UnbindEvents ¶
type Buffer ¶
type Buffer interface { LineCount() int GetLine(l, c int) (Line, error) InsertRune(r rune, l, c int) error InsertString(s string, l, c int) (int, int, error) InsertLine(l int, line Line) error DeleteLine(l int) error MergeLineWithPrevious(l int) error SplitLine(l, c int) error DeleteRuneAt(l, c int) error AdvancePos(l, c, dl, dc int) (int, int) EndPos() (int, int) AppendLine(Line) Save() error StyledLineIter(l, c int) StyledLineIter Kind() string StringFromRegion(l0, c0, l1, c1 int) (string, error) }
type Command ¶
type Command struct { Name string Description string Parameters []Parameter Action CommandAction }
type CommandAction ¶
type CommandAction interface {
Apply(w *App)
}
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
func NewEventHandler ¶
func NewEventHandler() *EventHandler
func (*EventHandler) HandleEvent ¶
func (h *EventHandler) HandleEvent(evt Event) (Action, error)
HandleEvent transitions the state of the event handler and returns any action that may be triggered.
func (*EventHandler) RegisterAction ¶
func (h *EventHandler) RegisterAction(seq string, action ActionMaker) error
RegisterAction associates the given action with the event sequence represented by seq. E.g. RegisterAction("x y z", action) will create the following transitions:
"" -x-> x x -y-> x:y x:y -z-> x:y:z
It will also record that the state x:y:z triggers action x:y:z triggers action
func (*EventHandler) Reset ¶
func (h *EventHandler) Reset()
Reset the handler so any ongoing sequence is aborted.
func (*EventHandler) UnregisterAction ¶
func (h *EventHandler) UnregisterAction(seq string) error
type FileBuffer ¶
type FileBuffer struct {
// contains filtered or unexported fields
}
A FileBuffer maintains the data for a file.
func NewBufferFromFile ¶
func NewBufferFromFile(filename string) *FileBuffer
func NewEmptyFileBuffer ¶
func NewEmptyFileBuffer() *FileBuffer
func (*FileBuffer) AdvancePos ¶
func (b *FileBuffer) AdvancePos(l, c, dl, dc int) (int, int)
func (*FileBuffer) AppendLine ¶
func (b *FileBuffer) AppendLine(line Line)
func (*FileBuffer) DeleteLine ¶
func (b *FileBuffer) DeleteLine(l int) error
func (*FileBuffer) DeleteRuneAt ¶
func (b *FileBuffer) DeleteRuneAt(l, c int) error
func (*FileBuffer) EndPos ¶
func (b *FileBuffer) EndPos() (int, int)
func (*FileBuffer) InsertLine ¶
func (b *FileBuffer) InsertLine(l int, line Line) error
func (*FileBuffer) InsertRune ¶
func (b *FileBuffer) InsertRune(r rune, l, c int) error
func (*FileBuffer) InsertString ¶
func (*FileBuffer) Kind ¶
func (b *FileBuffer) Kind() string
func (*FileBuffer) Line ¶
func (b *FileBuffer) Line(l int) Line
func (*FileBuffer) LineCount ¶
func (b *FileBuffer) LineCount() int
func (*FileBuffer) MergeLineWithPrevious ¶
func (b *FileBuffer) MergeLineWithPrevious(l int) error
func (*FileBuffer) NearestPos ¶
func (b *FileBuffer) NearestPos(l, c int) (int, int)
func (*FileBuffer) Save ¶
func (b *FileBuffer) Save() error
func (*FileBuffer) SplitLine ¶
func (b *FileBuffer) SplitLine(l, c int) error
func (*FileBuffer) StringFromRegion ¶
func (b *FileBuffer) StringFromRegion(l0, c0, l1, c1 int) (string, error)
func (*FileBuffer) StyledLineIter ¶
func (b *FileBuffer) StyledLineIter(l, c int) StyledLineIter
func (*FileBuffer) Truncate ¶
func (b *FileBuffer) Truncate(count int)
type Invocation ¶
type Invocation struct { *Command Arguments []interface{} }
type Line ¶
type Line struct { Runes []rune Meta interface{} }
func NewLineFromString ¶
func (Line) InsertString ¶
s must not contain a '\n'
type MouseButtons ¶
type MouseButtons int
const ( Button1 MouseButtons = 1 << iota Button2 Button3 WheelDown WheelUp WheelLeft WheelRight )
func (MouseButtons) Empty ¶
func (mb MouseButtons) Empty() bool
func (MouseButtons) Has ¶
func (mb MouseButtons) Has(mb1 MouseButtons) bool
func (MouseButtons) Name ¶
func (mb MouseButtons) Name() string
type MouseData ¶
type MouseData struct { Position Buttons MouseButtons ButtonsPressed MouseButtons ButtonsReleased MouseButtons }
type Printer ¶
A Printer knows how to print lines on a screen
func (Printer) Print ¶
func (lp Printer) Print(s ScreenWriter, p Position, iter StyledLineIter)
Print the line to the screen starting at coordinates (p.X, p.Y)
type Rectangle ¶
func (Rectangle) BottomRight ¶
type Screen ¶
type Screen struct {
// contains filtered or unexported fields
}
func (*Screen) SubScreen ¶
func (s *Screen) SubScreen(rect Rectangle) ScreenWriter
type ScreenWriter ¶
type StyledLineIter ¶
func NewConstStyleLineIter ¶
func NewConstStyleLineIter(iter LineIter, style Style) StyledLineIter
type SubScreen ¶
type SubScreen struct {
// contains filtered or unexported fields
}
func (SubScreen) SubScreen ¶
func (s SubScreen) SubScreen(rect Rectangle) ScreenWriter
type TcellEventConverter ¶
type TcellEventConverter struct {
// contains filtered or unexported fields
}
func (*TcellEventConverter) EventFromTcell ¶
func (c *TcellEventConverter) EventFromTcell(tcevt tcell.Event) Event
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
A Window is a view to a buffer. It maintains a cursor position, and a rectangle view into the buffer.
func (*Window) CurrentLine ¶
CurrentLine returns the line the cursor is on currently.
func (*Window) CursorLine ¶
func (*Window) DeleteRune ¶
DeleteRune deletes the character to the left of the cursor position.
func (*Window) Draw ¶
func (w *Window) Draw(screen ScreenWriter)
Draw draws the contents of the window on the screen.
func (*Window) DrawCursor ¶
func (w *Window) DrawCursor(screen ScreenWriter)
DrawCursor highlights the cursor if it is visible.
func (*Window) FocusCursor ¶
func (w *Window) FocusCursor(screen ScreenWriter)
FocusCursor adjusts the visible rectangle of the window if necessary to make the cursor visible.
func (*Window) GetHighlightedString ¶
func (*Window) InsertRune ¶
InsertRune inserts a character into the buffer at the cursor position.
func (*Window) MoveCursor ¶
MoveCursor moves the cursor by a number of lines and columns.
func (*Window) MoveCursorTo ¶
MoveCursorTo moves the cursor to a given screen position.
func (*Window) MoveCursorToEnd ¶
func (w *Window) MoveCursorToEnd()
func (*Window) MoveCursorToLineEnd ¶
func (w *Window) MoveCursorToLineEnd()
MoveCursorToLineEnd moves the cursor to the end of the current line.
func (*Window) MoveCursorToLineStart ¶
func (w *Window) MoveCursorToLineStart()
MoveCursorToLineStart moves the cursor to the start of the current line.
func (*Window) MoveHighlightRegion ¶
func (*Window) PasteString ¶
func (*Window) RegisterWithApp ¶
func (*Window) ResetHighlightRegion ¶
func (w *Window) ResetHighlightRegion()
func (*Window) ScrollDown ¶
ScrollDown scrolls down by n lines, attempting to keep the cursor on the same buffer line.
func (*Window) ScrollUp ¶
ScrollUp scrolls up by n lines, attempting to keep the cursor on the same buffer line.
func (*Window) SplitLine ¶
SplitLine splits the current line at the cursor position. If move is true, the cursor is moved down otherwise it stays in the same position.
func (*Window) StartHighlightRegion ¶
func (*Window) StopHightlightRegion ¶
func (*Window) StyledLineIter ¶
func (w *Window) StyledLineIter(l, c int) StyledLineIter