Documentation ¶
Index ¶
- Constants
- func ANSIWriter(writer io.Writer) io.Writer
- func InitScreenAndRun(m *testing.M, screen *tcell.Screen)
- func TranslateANSI(text string) string
- type Box
- type Canvas
- type ColorLayout
- type Component
- func Bg(del Component, color tcell.Color) Component
- func BgColoredString(s string, fg tcell.Color, bg tcell.Color) Component
- func ColoredString(s string, fg tcell.Color) Component
- func Fg(del Component, color tcell.Color) Component
- func NewScrollingWrappingTextArea(name string, text string) Component
- func TextString(s string) Component
- type ConcatLayout
- type Dir
- type ElementScrollController
- type ElementScrollLayout
- func (l *ElementScrollLayout) Add(c Component)
- func (l *ElementScrollLayout) Render(w Writer, width, height int) error
- func (l *ElementScrollLayout) RenderStateful(w Writer, prevState interface{}, width, height int) (state interface{}, err error)
- func (l *ElementScrollLayout) Size(width int, height int) (int, int)
- type ElementScrollState
- type ElementScroller
- type FixedSizeLayout
- type FlexLayout
- type InteractiveTester
- type Line
- type ModalLayout
- type RTY
- type ScreenCanvas
- type StatefulComponent
- type StringBuilder
- type StringLayout
- type SubCanvas
- type TempCanvas
- type TextScrollController
- type TextScrollLayout
- func (l *TextScrollLayout) Add(c Component)
- func (l *TextScrollLayout) Render(w Writer, width, height int) error
- func (l *TextScrollLayout) RenderStateful(w Writer, prevState interface{}, width, height int) (state interface{}, err error)
- func (l *TextScrollLayout) Size(width int, height int) (int, int)
- type TextScrollState
- type TextScroller
- type Writer
Constants ¶
const GROW = math.MaxInt32
Variables ¶
This section is empty.
Functions ¶
func ANSIWriter ¶
ANSIWriter returns an io.Writer which translates any ANSI escape codes written to it into tview color tags. Other escape codes don't have an effect and are simply removed. The translated text is written to the provided writer.
func InitScreenAndRun ¶ added in v0.1.0
unfortunately, tcell misbehaves if we try to make a new Screen for every test this function is intended for use from a `TestMain`, so that we can have a global Screen across all tests in the package
func TranslateANSI ¶
TranslateANSI replaces ANSI escape sequences found in the provided string with tview's color tags and returns the resulting string.
Types ¶
type ColorLayout ¶
type ColorLayout struct {
// contains filtered or unexported fields
}
type Component ¶
type Component interface { Size(availWidth, availHeight int) (int, int) Render(w Writer, width, height int) error }
Component renders onto a canvas
func TextString ¶
type ConcatLayout ¶
type ConcatLayout struct {
// contains filtered or unexported fields
}
func NewConcatLayout ¶
func NewConcatLayout(dir Dir) *ConcatLayout
func NewLines ¶
func NewLines() *ConcatLayout
func (*ConcatLayout) Add ¶
func (l *ConcatLayout) Add(c Component)
type ElementScrollController ¶
type ElementScrollController struct {
// contains filtered or unexported fields
}
func (*ElementScrollController) Bottom ¶ added in v0.1.0
func (s *ElementScrollController) Bottom()
func (*ElementScrollController) Down ¶ added in v0.1.0
func (s *ElementScrollController) Down()
func (*ElementScrollController) GetSelectedChild ¶
func (s *ElementScrollController) GetSelectedChild() string
func (*ElementScrollController) GetSelectedIndex ¶
func (s *ElementScrollController) GetSelectedIndex() int
func (*ElementScrollController) Top ¶ added in v0.1.0
func (s *ElementScrollController) Top()
func (*ElementScrollController) Up ¶ added in v0.1.0
func (s *ElementScrollController) Up()
type ElementScrollLayout ¶
type ElementScrollLayout struct {
// contains filtered or unexported fields
}
func NewElementScrollLayout ¶
func NewElementScrollLayout(name string) *ElementScrollLayout
func (*ElementScrollLayout) Add ¶
func (l *ElementScrollLayout) Add(c Component)
func (*ElementScrollLayout) Render ¶
func (l *ElementScrollLayout) Render(w Writer, width, height int) error
func (*ElementScrollLayout) RenderStateful ¶
func (l *ElementScrollLayout) RenderStateful(w Writer, prevState interface{}, width, height int) (state interface{}, err error)
type ElementScrollState ¶
type ElementScrollState struct {
// contains filtered or unexported fields
}
type ElementScroller ¶
type ElementScroller interface { Up() Down() Top() Bottom() GetSelectedIndex() int }
type FixedSizeLayout ¶
type FixedSizeLayout struct {
// contains filtered or unexported fields
}
FixedSizeLayout fixes a component to a size
func NewFixedSize ¶
func NewFixedSize(del Component, width int, height int) *FixedSizeLayout
type FlexLayout ¶
type FlexLayout struct {
// contains filtered or unexported fields
}
FlexLayout lays out its sub-components.
func NewFlexLayout ¶
func NewFlexLayout(dir Dir) *FlexLayout
func (*FlexLayout) Add ¶
func (l *FlexLayout) Add(c Component)
type InteractiveTester ¶ added in v0.1.0
type InteractiveTester struct {
// contains filtered or unexported fields
}
func NewInteractiveTester ¶ added in v0.1.0
func NewInteractiveTester(t *testing.T, screen tcell.Screen) InteractiveTester
type ModalLayout ¶ added in v0.1.0
type ModalLayout struct {
// contains filtered or unexported fields
}
func NewModalLayout ¶ added in v0.1.0
func NewModalLayout(bg Component, fg Component, fraction float64) *ModalLayout
fg will be rendered on top of bg, using fraction/1 of the height and width of the screen
type RTY ¶
type RTY interface { Render(c Component) error // Register must be called before Render RegisterElementScroll(name string, children []string) (l *ElementScrollLayout, selectedChild string) // *Scroller must be called after Render (each call to Render invalidates previous Crollers) ElementScroller(name string) ElementScroller TextScroller(name string) TextScroller }
type ScreenCanvas ¶
type ScreenCanvas struct {
// contains filtered or unexported fields
}
func (*ScreenCanvas) Close ¶
func (c *ScreenCanvas) Close() (int, int)
func (*ScreenCanvas) GetContent ¶
func (*ScreenCanvas) SetContent ¶
func (*ScreenCanvas) Size ¶
func (c *ScreenCanvas) Size() (int, int)
type StatefulComponent ¶
type StringBuilder ¶
type StringBuilder interface { Text(string) StringBuilder Textf(string, ...interface{}) StringBuilder Fg(tcell.Color) StringBuilder Bg(tcell.Color) StringBuilder Build() Component }
func NewStringBuilder ¶
func NewStringBuilder() StringBuilder
type StringLayout ¶
type StringLayout struct {
// contains filtered or unexported fields
}
type SubCanvas ¶
type SubCanvas struct {
// contains filtered or unexported fields
}
func (*SubCanvas) GetContent ¶
func (*SubCanvas) SetContent ¶
type TempCanvas ¶
type TempCanvas struct {
// contains filtered or unexported fields
}
func (*TempCanvas) Close ¶
func (c *TempCanvas) Close() (int, int)
func (*TempCanvas) GetContent ¶
func (*TempCanvas) SetContent ¶
func (*TempCanvas) Size ¶
func (c *TempCanvas) Size() (int, int)
type TextScrollController ¶
type TextScrollController struct {
// contains filtered or unexported fields
}
func (*TextScrollController) Bottom ¶ added in v0.1.0
func (s *TextScrollController) Bottom()
func (*TextScrollController) Down ¶
func (s *TextScrollController) Down()
func (*TextScrollController) SetFollow ¶ added in v0.1.0
func (s *TextScrollController) SetFollow(follow bool)
func (*TextScrollController) ToggleFollow ¶
func (s *TextScrollController) ToggleFollow()
func (*TextScrollController) Top ¶ added in v0.1.0
func (s *TextScrollController) Top()
func (*TextScrollController) Up ¶
func (s *TextScrollController) Up()
type TextScrollLayout ¶
type TextScrollLayout struct {
// contains filtered or unexported fields
}
func NewTextScrollLayout ¶
func NewTextScrollLayout(name string) *TextScrollLayout
func (*TextScrollLayout) Add ¶
func (l *TextScrollLayout) Add(c Component)
func (*TextScrollLayout) Render ¶
func (l *TextScrollLayout) Render(w Writer, width, height int) error
func (*TextScrollLayout) RenderStateful ¶
func (l *TextScrollLayout) RenderStateful(w Writer, prevState interface{}, width, height int) (state interface{}, err error)
type TextScrollState ¶
type TextScrollState struct {
// contains filtered or unexported fields
}
type TextScroller ¶
type TextScroller interface { Up() Down() Top() Bottom() ToggleFollow() SetFollow(following bool) }
type Writer ¶
type Writer interface { SetContent(x int, y int, mainc rune, combc []rune) Divide(x, y, width, height int) Writer Foreground(c tcell.Color) Writer Background(c tcell.Color) Writer Fill() Writer RenderChild(c Component) int RenderChildInTemp(c Component) Canvas Embed(src Canvas, srcY, srcHeight int) RenderStateful(c StatefulComponent, name string) }