Documentation ¶
Overview ¶
Package display provides advanced methods of logging to a terminal.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Display ¶
type Display struct {
// contains filtered or unexported fields
}
Display divides the screen into multiple independently-scrollable logging areas.
Output is separated into three areas:
+------------+ | Persistent | | ... | +------------+ | Status | +------------+ | Verbose | | ... | +------------+
The persistent area contains important messages that should remain onscreen for as long as possible. New messages are logged at the bottom of the area, which grows upward until it reaches the top of the screen.
The status line is used to display the current progress and can be updated frequently.
The verbose area contains transient messages. It's assumed that only the last few verbose messages are still relevent. New messages are logged at the bottom of the area, which grows downward, but only to a fixed maximum height. If the area reaches the bottom of the screen before hitting its maximum height, all areas are pushed upward.
TODO(derat): Detect screen resize (with SIGWINCH?) and reinitialize everything.
func New ¶
New returns a new Display backed by tm. The verbose area can grow to maxVerboseRows rows before scrolling.
func (*Display) AddPersistent ¶
AddPersistent adds s to the bottom of the persistent area. Long lines are truncated, and trailing empty lines are dropped.
func (*Display) AddVerbose ¶
AddVerbose adds s to the bottom of the persistent area. Long lines are truncated, and trailing empty lines are dropped.