Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Index your code
hub
/
github.com/rivo/tview
/ functions
Functions
690 in github.com/rivo/tview
⨍
Functions
690
◇
Types & classes
50
↓ 88 callers
Method
AddItem
AddItem adds a primitive and its position to the grid. The top-left corner of the primitive will be located in the top-left corner of the grid cell at
grid.go:201
↓ 46 callers
Method
HasFocus
HasFocus determines if the primitive has focus. This function must return true also if one of this primitive's child elements has focus.
primitive.go:43
↓ 33 callers
Method
GetInnerRect
GetInnerRect returns the position of the inner rectangle (x, y, width, height), without the border and without any padding. Width and height values wi
box.go:100
↓ 33 callers
Function
NewBox
NewBox returns a Box without a border.
box.go:72
↓ 30 callers
Method
SetBorder
SetBorder sets the flag indicating whether or not the box should have a border.
box.go:297
↓ 28 callers
Method
SetContent
SetContent sets a new content type for this table. This allows you to back the table by a data structure of your own, for example one that cannot be f
table.go:555
↓ 27 callers
Method
SetTitle
SetTitle sets the box's title.
box.go:341
↓ 26 callers
Method
findCursor
findCursor determines the cursor position if its "row" value is < 0 (=unknown) but only its span position ("pos" value) is known. If the cursor positi
textarea.go:1464
↓ 25 callers
Method
SetText
SetText sets the message text of the window. The text may contain line breaks but style tag states will not transfer to following lines. Note that wor
modal.go:103
↓ 25 callers
Function
printWithStyle
printWithStyle works like [Print] but it takes a style instead of just a foreground color. The skipWidth parameter specifies the number of cells skipp
util.go:60
↓ 23 callers
Method
EnableMouse
EnableMouse enables mouse events or disables them (if "false" is provided).
application.go:237
↓ 23 callers
Function
NewApplication
NewApplication creates and returns a new application.
application.go:137
↓ 23 callers
Method
Run
Run starts the application and thus the event loop. This function returns when [Application.Stop] was called. Note that while an application is runni
application.go:279
↓ 19 callers
Function
NewTextView
NewTextView returns a new text view.
textview.go:244
↓ 18 callers
Method
DrawForSubclass
DrawForSubclass draws this box under the assumption that primitive p is a subclass of this box. This is needed e.g. to draw proper box frames which de
box.go:375
↓ 18 callers
Method
SetDoneFunc
SetDoneFunc sets a function which is called when the user presses the Escape key.
list.go:355
↓ 18 callers
Method
SetRect
SetRect sets a new position of the primitive.
primitive.go:17
↓ 17 callers
Method
InRect
InRect returns true if the given coordinate is within the bounds of the box's rectangle.
box.go:270
↓ 17 callers
Method
SetBorders
SetBorders sets whether or not borders are drawn around grid items. Setting this value to true will cause the gap values (see SetGap()) to be ignored
grid.go:163
↓ 17 callers
Function
TaggedStringWidth
TaggedStringWidth returns the width of the given string needed to print it on screen. The text may contain style tags which are not counted.
strings.go:535
↓ 17 callers
Method
WrapInputHandler
WrapInputHandler wraps an input handler (see [Box.InputHandler]) with the functionality to capture input (see [Box.SetInputCapture]) before passing it
box.go:161
↓ 17 callers
Method
WrapMouseHandler
WrapMouseHandler wraps a mouse event handler (see [Box.MouseHandler]) with the functionality to capture mouse events (see [Box.SetMouseCapture]) befor
box.go:220
↓ 17 callers
Method
truncateLines
truncateLines truncates the trailing lines of the [TextArea.lineStarts] slice such that len(lineStarts) <= fromLine. If fromLine is negative, a value
textarea.go:1443
↓ 16 callers
Method
Draw
Draw draws this primitive onto the screen. Implementers can call the screen's ShowCursor() function but should only do so when they have focus. (They
primitive.go:10
↓ 15 callers
Method
InputHandler
InputHandler returns a handler which receives key events when it has focus. It is called by the Application class. A value of nil may also be returne
primitive.go:35
↓ 15 callers
Method
SetRoot
SetRoot sets the root primitive for this application. If "fullscreen" is set to true, the root primitive's position will be changed to fill the screen
application.go:808
↓ 14 callers
Function
NewFlex
NewFlex returns a new flexbox layout container with no primitives and its direction set to FlexColumn. To add primitives to this layout, see AddItem()
flex.go:57
↓ 14 callers
Method
moveCursor
moveCursor sets the cursor's screen position and span position for the given row and column which are screen space coordinates relative to the top-lef
textarea.go:1693
↓ 14 callers
Method
replace
replace deletes a range of text and inserts the given text at that position. If the resulting text would exceed the maximum length, the function does
textarea.go:1007
↓ 13 callers
Method
Clear
Remove all table data.
table.go:275
↓ 13 callers
Method
Focus
Focus is called by the application when the primitive receives focus. Implementers may call delegate() to pass the focus on to another primitive.
primitive.go:39
↓ 13 callers
Method
MouseHandler
MouseHandler returns a handler which receives mouse events. It is called by the Application class. A value of nil may also be returned to stop the do
primitive.go:57
↓ 13 callers
Method
SetLabel
SetLabel sets the text to be displayed before the image.
image.go:212
↓ 13 callers
Method
Stop
Stop stops the application, causing Run() to return.
application.go:624
↓ 13 callers
Function
step
step uses uniseg.Step to iterate over the grapheme clusters of a string but (optionally) also parses the string for style or region tags. This functi
strings.go:110
↓ 12 callers
Method
AddText
AddText adds text to the frame. Set "header" to true if the text is to appear in the header, above the contained primitive. Set it to false for it to
frame.go:80
↓ 12 callers
Method
Highlight
Highlight specifies which regions should be highlighted. If highlight toggling is set to true (see [TextView.SetToggleHighlights]), the highlight of t
textview.go:623
↓ 12 callers
Method
SetDynamicColors
SetDynamicColors sets the flag that allows the text color to be changed dynamically with style tags. See class description for details.
textview.go:470
↓ 12 callers
Method
SetSelectable
SetSelectable sets the flags which determine what can be selected in a table. There are three selection modi: - rows = false, columns = false: Nothin
table.go:624
↓ 11 callers
Method
Width
Width returns the grapheme cluster's width in cells.
strings.go:72
↓ 11 callers
Method
draw
draw actually does what Draw() promises to do.
application.go:703
↓ 11 callers
Method
resetIndex
resetIndex resets all indexed data, including the line index.
textview.go:855
↓ 11 callers
Method
step
step is similar to [github.com/rivo/uniseg.StepString] but it iterates over the piece chain, starting with "pos", a span position plus state (which ma
textarea.go:1621
↓ 10 callers
Method
AddPage
AddPage adds a new page with the given name and primitive. If there was previously a page with the same name, it is overwritten. Leaving the name empt
pages.go:76
↓ 10 callers
Function
PrintJoinedSemigraphics
PrintJoinedSemigraphics prints a semigraphics rune into the screen at the given position with the given style, joining it with any existing semigraphi
semigraphics.go:309
↓ 10 callers
Method
SetRoot
SetRoot sets the root node of the tree.
treeview.go:367
↓ 9 callers
Function
Escape
Escape escapes the given text such that color and/or region tags are not recognized and substituted by the print functions of this package. For exampl
strings.go:612
↓ 9 callers
Method
GetCell
Return the cell at the given position or nil if there is no cell. The row and column arguments start at 0 and end at what GetRowCount() and GetColumnC
table.go:238
↓ 9 callers
Method
GetText
GetText returns the current text of the input field.
inputfield.go:163
↓ 9 callers
Method
PasteHandler
PasteHandler returns a handler which receives pasted text. It is called by the Application class. A value of nil may also be returned to stop the dow
primitive.go:68
↓ 9 callers
Method
WrapPasteHandler
WrapPasteHandler wraps a paste handler (see [Box.PasteHandler]).
box.go:178
↓ 9 callers
Method
extendLines
extendLines traverses the current text and extends [TextArea.lineStarts] such that it describes at least maxLines+1 lines (or less if the text is shor
textarea.go:1353
↓ 9 callers
Method
getSelection
getSelection returns the current selection as span locations where the first returned location is always before or the same as the second returned loc
textarea.go:1910
↓ 8 callers
Method
GetLabel
GetLabel returns the item's label text.
form.go:26
↓ 8 callers
Function
NewList
NewList returns a new list.
list.go:101
↓ 8 callers
Method
SetBorderPadding
SetBorderPadding sets the size of the borders around the box content.
box.go:86
↓ 8 callers
Method
SetSelectedFunc
SetSelectedFunc sets the function which is called when the user selects a list item by pressing Enter on the current selection. The function receives
list.go:342
↓ 8 callers
Method
SetWrap
SetWrap sets the flag that, if true, leads to lines that are longer than the available width being wrapped onto the next line. If false, any character
textarea.go:762
↓ 7 callers
Method
AddButton
AddButton adds a new button to the form. The "selected" function is called when the user selects this button. It may be nil.
form.go:373
↓ 7 callers
Method
Focus
Focus is called by the application when the primitive receives focus.
pages.go:273
↓ 7 callers
Method
GrossLength
GrossLength returns the grapheme cluster's length in bytes, including any tags that were parsed but not explicitly returned.
strings.go:78
↓ 7 callers
Method
HasFocus
HasFocus returns whether or not this primitive has focus.
pages.go:263
↓ 7 callers
Function
NewInputField
NewInputField returns a new input field.
inputfield.go:131
↓ 7 callers
Method
ScrollToHighlight
ScrollToHighlight will cause the visible area to be scrolled so that the highlighted regions appear in the visible area of the text view. This reposit
textview.go:721
↓ 7 callers
Method
SetAlign
SetAlign sets the vertical and horizontal alignment of the image within the widget's space. The possible values are [AlignTop], [AlignCenter], and [Al
image.go:205
↓ 7 callers
Method
SetInputCapture
SetInputCapture installs a function which captures key events before they are forwarded to the primitive's default key event handler. This function ca
box.go:204
↓ 7 callers
Method
parseAhead
parseAhead parses the text buffer starting at the last line in [TextView.lineIndex] until either the end of the buffer or until stop returns true for
textview.go:872
↓ 6 callers
Method
EnablePaste
EnablePaste enables the capturing of paste events or disables them (if "false" is provided). This must be supported by the terminal. Widgets won't in
application.go:257
↓ 6 callers
Function
NewPages
NewPages returns a new Pages object.
pages.go:36
↓ 6 callers
Method
Replace
Replace replaces a section of the text with new text. The start and end positions refer to index positions within the entire text string (as a half-op
textarea.go:632
↓ 6 callers
Method
SetBackgroundColor
SetBackgroundColor sets the box's background color.
box.go:289
↓ 6 callers
Method
SetChangedFunc
SetChangedFunc sets the function which is called when the user navigates to a list item. The function receives the item's index in the list of items (
list.go:333
↓ 6 callers
Method
SetCurrentItem
SetCurrentItem sets the currently selected item by its index, starting at 0 for the first item. If a negative index is provided, items are referred to
list.go:121
↓ 6 callers
Method
SetDirection
SetDirection sets the direction in which the contained primitives are distributed. This can be either FlexColumn (default) or FlexRow. Note that these
flex.go:70
↓ 6 callers
Method
SetFocus
SetFocus sets the focus to a new primitive. All key events will be directed down the hierarchy (starting at the root) until a primitive handles them,
application.go:838
↓ 6 callers
Method
ShowSecondaryText
ShowSecondaryText determines whether or not to show secondary item texts.
list.go:312
↓ 5 callers
Method
AddButtons
AddButtons adds buttons to the window. There must be at least one button and a "done" handler so the window can be closed again.
modal.go:110
↓ 5 callers
Method
AddInputField
AddInputField adds an input field to the form. It has a label, an optional initial value, a field width (a value of 0 extends it as far as possible),
form.go:304
↓ 5 callers
Method
Autocomplete
Autocomplete invokes the autocomplete callback (if there is one, see [InputField.SetAutocompleteFunc]). If the length of the returned autocomplete ent
inputfield.go:354
↓ 5 callers
Method
Blur
Blur is called by the application when the primitive loses focus.
primitive.go:46
↓ 5 callers
Method
GetRowCount
Return the total number of rows in the table.
table.go:241
↓ 5 callers
Function
NewFrame
NewFrame returns a new frame around the given primitive. The primitive's size will be changed to fit within this frame. The primitive may be nil, in w
frame.go:38
↓ 5 callers
Function
NewGrid
NewGrid returns a new grid-based layout container with no initial primitives. Note that Box, the superclass of Grid, will be transparent so that any
grid.go:69
↓ 5 callers
Function
NewModal
NewModal returns a new modal message window.
modal.go:33
↓ 5 callers
Function
Print
Print prints text onto the screen into the given box at (x,y,maxWidth,1), not exceeding that box. "align" is one of AlignLeft, AlignCenter, or AlignRi
util.go:49
↓ 5 callers
Method
SetColors
SetColors sets the number of colors to use. This should be the number of colors supported by the terminal. If 0, the number of colors is chosen based
image.go:154
↓ 5 callers
Method
SetFieldWidth
SetFieldWidth sets the screen width of the options area. A value of 0 means extend to as long as the longest option text.
dropdown.go:281
↓ 5 callers
Method
SetRows
SetRows defines how the rows of the grid are distributed. These values behave the same as the column values provided with [Grid.SetColumns], see there
grid.go:119
↓ 5 callers
Method
SetSeparator
SetSeparator sets the character used to fill the space between two neighboring cells. This is a space character ' ' per default but you may want to se
table.go:604
↓ 5 callers
Method
SetTextColor
SetTextColor sets the color of the message text.
modal.go:62
↓ 5 callers
Method
moveWordLeft
moveWordLeft moves the cursor to the beginning of the current or previous word. If clamp is true, the cursor will be visible during the next call to [
textarea.go:1781
↓ 5 callers
Function
stripTags
stripTags strips style tags from the given string. (Region tags are not stripped.)
strings.go:623
↓ 4 callers
Function
Center
Center returns a new primitive which shows the provided primitive in its center, given the provided primitive's size.
demos/presentation/center.go:7
↓ 4 callers
Function
Code
Code returns a primitive which displays the given primitive (with the given size) on the left side and its source code on the right side.
demos/presentation/code.go:14
↓ 4 callers
Method
GetDisabled
GetDisabled returns whether or not the item is disabled / read-only.
textarea.go:844
↓ 4 callers
Method
GetHighlights
GetHighlights returns the IDs of all currently highlighted regions.
textview.go:697
↓ 4 callers
Method
GetText
GetText returns the entire text of the text area. Note that this will newly allocate the entire text.
textarea.go:440
↓ 4 callers
Function
NewForm
NewForm returns a new form.
form.go:108
↓ 4 callers
Function
NewTable
NewTable returns a new table.
table.go:538
↓ 4 callers
Function
NewTableCell
NewTableCell returns a new table cell with sensible defaults. That is, left aligned text with the primary text color (see Styles) and a transparent ba
table.go:74
next →
1–100 of 690, ranked by callers