 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package ui defines a thin framework for building terminal UIs using tcell and accompanying widgets.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnnotatedText ¶
type AnnotatedText struct {
	// Text block to render. This may be multi-line.
	Text  string
	Style tcell.Style
	// contains filtered or unexported fields
}
    AnnotatedText is a block of text rendered with annotations.
func (*AnnotatedText) Draw ¶
func (at *AnnotatedText) Draw(view views.View)
Draw draws the annotated text onto the provided view.
func (*AnnotatedText) HandleEvent ¶
func (at *AnnotatedText) HandleEvent(tcell.Event) bool
HandleEvent returns false.
func (*AnnotatedText) SetAnnotations ¶
func (at *AnnotatedText) SetAnnotations(anns ...TextAnnotation)
SetAnnotations changes the annotations for an AnnotatedText. Offsets MUST not overlap.
type App ¶
type App struct {
	// Root is the main application widget.
	Root Widget
	// Screen upon which to draw.
	Screen tcell.Screen
	// Logger to post messages to. Optional.
	Log *log.Logger
	// contains filtered or unexported fields
}
    App drives the main UI for the application.
func (*App) Start ¶
func (app *App) Start()
Start starts the app, rendering the root widget on the screen indefinitely until Stop is called.
type OverlayTextAnnotation ¶
type OverlayTextAnnotation struct {
	Overlay string
	Style   tcell.Style // style for the overlay
	// Offset in the text over which to draw this overlay.
	Offset int
}
    OverlayTextAnnotation overlays a different text over a section of text in AnnotatedText.
type Pos ¶
type Pos struct{ X, Y int }
    Pos is a position in the terminal UI.
func DrawText ¶
DrawText draws a string on the provided view at the specified position. Returns the new position, after having drawn the text, making it possible to continue drawing at the last written position.
pos = DrawText("foo\nb", style, view, pos)
pos = DrawText("ar", style, view, pos)
Text that bleeds outside the bounds of the view is ignored.
type StyleTextAnnotation ¶
type StyleTextAnnotation struct {
	Style tcell.Style // style for this section
	// Offset in the text, and the length of it for which this alternative
	// style applies.
	Offset, Length int
}
    StyleTextAnnotation changes the style of a section of text in AnnotatedText.
type TextAnnotation ¶
type TextAnnotation interface {
	// contains filtered or unexported methods
}
    TextAnnotation changes what gets rendered for AnnotatedText.
type Widget ¶
type Widget interface {
	// Draw draws the widget on the supplied view. Widgets do not need to
	// clear the view; the caller will do that for them.
	Draw(views.View)
	// HandleEvent handles the given event, or returns false if the event
	// wasn't meant for it.
	HandleEvent(tcell.Event) (handled bool)
}
    Widget is a drawable object that may handle events.