Documentation ¶
Index ¶
Constants ¶
const LINE_NO_MIN_SPACE = 1000
const NEW_LINE = "\n"
Variables ¶
This section is empty.
Functions ¶
func SprintFunctions ¶
func SprintFunctions(fs []GuiFunction) []string
func SprintLevels ¶
Types ¶
type CharField ¶
type CharField struct { ui.Block Text string TextColor ui.Attribute WrapLength int Alignment ui.Align PaddingTop int }
func NewCharField ¶
type EvtInput ¶
EvtInput defines the structure for the /input/* events. The event contains the last keystroke, the full text for the current line, and the position of the cursor in the current line as well as the index of the current line in the full text of the input
type GuiFunction ¶
type Input ¶
type Input struct { ui.Block TextFgColor ui.Attribute TextBgColor ui.Attribute IsCapturing bool IsMultiLine bool TextBuilder ui.TextBuilder SpecialChars map[string]string ShowLineNo bool Name string CursorX int CursorY int // contains filtered or unexported fields }
Input is the main object for a text input. The object exposes the following public properties: TextFgColor: color for the text. TextBgColor: background color for the text box. IsCapturing: true if the input is currently capturing keyboard events, this is controlled by the StartCapture and
StopCapture methods.
IsMultiline: Whether we should accept multiple lines of input or this is a singe line form field. TextBuilder: An implementation of the TextBuilder interface to customize the look of the text on the screen. SpecialChars: a map[string]string of characters from the /sys/kbd events to actual strings in the content. Name: When specified, the Input uses its name to propagate events, for example /input/<name>/kbd.
func NewInput ¶
NewInput returns a new, initialized Input object. The method receives the initial content for the input (if any) and whether it should be initialized as a multi-line innput field or not
func (*Input) Lines ¶
Lines returns the slice of strings with the content of the input field. By default lines are separated by \n
func (*Input) StartCapture ¶
func (i *Input) StartCapture()
StartCapture begins catching events from the /sys/kbd stream and updates the content of the Input field. While capturing events, the Input field also publishes its own event stream under the /input/kbd path.
func (*Input) StopCapture ¶
func (i *Input) StopCapture()
StopCapture tells the Input field to stop accepting events from the /sys/kbd stream