id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
163,800 | rivo/tview | box.go | SetBorderColor | func (b *Box) SetBorderColor(color tcell.Color) *Box {
b.borderColor = color
return b
} | go | func (b *Box) SetBorderColor(color tcell.Color) *Box {
b.borderColor = color
return b
} | [
"func",
"(",
"b",
"*",
"Box",
")",
"SetBorderColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"Box",
"{",
"b",
".",
"borderColor",
"=",
"color",
"\n",
"return",
"b",
"\n",
"}"
] | // SetBorderColor sets the box's border color. | [
"SetBorderColor",
"sets",
"the",
"box",
"s",
"border",
"color",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/box.go#L201-L204 |
163,801 | rivo/tview | box.go | SetTitle | func (b *Box) SetTitle(title string) *Box {
b.title = title
return b
} | go | func (b *Box) SetTitle(title string) *Box {
b.title = title
return b
} | [
"func",
"(",
"b",
"*",
"Box",
")",
"SetTitle",
"(",
"title",
"string",
")",
"*",
"Box",
"{",
"b",
".",
"title",
"=",
"title",
"\n",
"return",
"b",
"\n",
"}"
] | // SetTitle sets the box's title. | [
"SetTitle",
"sets",
"the",
"box",
"s",
"title",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/box.go#L216-L219 |
163,802 | rivo/tview | box.go | SetTitleColor | func (b *Box) SetTitleColor(color tcell.Color) *Box {
b.titleColor = color
return b
} | go | func (b *Box) SetTitleColor(color tcell.Color) *Box {
b.titleColor = color
return b
} | [
"func",
"(",
"b",
"*",
"Box",
")",
"SetTitleColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"Box",
"{",
"b",
".",
"titleColor",
"=",
"color",
"\n",
"return",
"b",
"\n",
"}"
] | // SetTitleColor sets the box's title color. | [
"SetTitleColor",
"sets",
"the",
"box",
"s",
"title",
"color",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/box.go#L222-L225 |
163,803 | rivo/tview | box.go | SetTitleAlign | func (b *Box) SetTitleAlign(align int) *Box {
b.titleAlign = align
return b
} | go | func (b *Box) SetTitleAlign(align int) *Box {
b.titleAlign = align
return b
} | [
"func",
"(",
"b",
"*",
"Box",
")",
"SetTitleAlign",
"(",
"align",
"int",
")",
"*",
"Box",
"{",
"b",
".",
"titleAlign",
"=",
"align",
"\n",
"return",
"b",
"\n",
"}"
] | // SetTitleAlign sets the alignment of the title, one of AlignLeft, AlignCenter,
// or AlignRight. | [
"SetTitleAlign",
"sets",
"the",
"alignment",
"of",
"the",
"title",
"one",
"of",
"AlignLeft",
"AlignCenter",
"or",
"AlignRight",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/box.go#L229-L232 |
163,804 | rivo/tview | treeview.go | NewTreeNode | func NewTreeNode(text string) *TreeNode {
return &TreeNode{
text: text,
color: Styles.PrimaryTextColor,
indent: 2,
expanded: true,
selectable: true,
}
} | go | func NewTreeNode(text string) *TreeNode {
return &TreeNode{
text: text,
color: Styles.PrimaryTextColor,
indent: 2,
expanded: true,
selectable: true,
}
} | [
"func",
"NewTreeNode",
"(",
"text",
"string",
")",
"*",
"TreeNode",
"{",
"return",
"&",
"TreeNode",
"{",
"text",
":",
"text",
",",
"color",
":",
"Styles",
".",
"PrimaryTextColor",
",",
"indent",
":",
"2",
",",
"expanded",
":",
"true",
",",
"selectable",
... | // NewTreeNode returns a new tree node. | [
"NewTreeNode",
"returns",
"a",
"new",
"tree",
"node",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L52-L60 |
163,805 | rivo/tview | treeview.go | SetChildren | func (n *TreeNode) SetChildren(childNodes []*TreeNode) *TreeNode {
n.children = childNodes
return n
} | go | func (n *TreeNode) SetChildren(childNodes []*TreeNode) *TreeNode {
n.children = childNodes
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"SetChildren",
"(",
"childNodes",
"[",
"]",
"*",
"TreeNode",
")",
"*",
"TreeNode",
"{",
"n",
".",
"children",
"=",
"childNodes",
"\n",
"return",
"n",
"\n",
"}"
] | // SetChildren sets this node's child nodes. | [
"SetChildren",
"sets",
"this",
"node",
"s",
"child",
"nodes",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L103-L106 |
163,806 | rivo/tview | treeview.go | AddChild | func (n *TreeNode) AddChild(node *TreeNode) *TreeNode {
n.children = append(n.children, node)
return n
} | go | func (n *TreeNode) AddChild(node *TreeNode) *TreeNode {
n.children = append(n.children, node)
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"AddChild",
"(",
"node",
"*",
"TreeNode",
")",
"*",
"TreeNode",
"{",
"n",
".",
"children",
"=",
"append",
"(",
"n",
".",
"children",
",",
"node",
")",
"\n",
"return",
"n",
"\n",
"}"
] | // AddChild adds a new child node to this node. | [
"AddChild",
"adds",
"a",
"new",
"child",
"node",
"to",
"this",
"node",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L125-L128 |
163,807 | rivo/tview | treeview.go | SetSelectable | func (n *TreeNode) SetSelectable(selectable bool) *TreeNode {
n.selectable = selectable
return n
} | go | func (n *TreeNode) SetSelectable(selectable bool) *TreeNode {
n.selectable = selectable
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"SetSelectable",
"(",
"selectable",
"bool",
")",
"*",
"TreeNode",
"{",
"n",
".",
"selectable",
"=",
"selectable",
"\n",
"return",
"n",
"\n",
"}"
] | // SetSelectable sets a flag indicating whether this node can be selected by
// the user. | [
"SetSelectable",
"sets",
"a",
"flag",
"indicating",
"whether",
"this",
"node",
"can",
"be",
"selected",
"by",
"the",
"user",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L132-L135 |
163,808 | rivo/tview | treeview.go | SetExpanded | func (n *TreeNode) SetExpanded(expanded bool) *TreeNode {
n.expanded = expanded
return n
} | go | func (n *TreeNode) SetExpanded(expanded bool) *TreeNode {
n.expanded = expanded
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"SetExpanded",
"(",
"expanded",
"bool",
")",
"*",
"TreeNode",
"{",
"n",
".",
"expanded",
"=",
"expanded",
"\n",
"return",
"n",
"\n",
"}"
] | // SetExpanded sets whether or not this node's child nodes should be displayed. | [
"SetExpanded",
"sets",
"whether",
"or",
"not",
"this",
"node",
"s",
"child",
"nodes",
"should",
"be",
"displayed",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L145-L148 |
163,809 | rivo/tview | treeview.go | ExpandAll | func (n *TreeNode) ExpandAll() *TreeNode {
n.Walk(func(node, parent *TreeNode) bool {
node.expanded = true
return true
})
return n
} | go | func (n *TreeNode) ExpandAll() *TreeNode {
n.Walk(func(node, parent *TreeNode) bool {
node.expanded = true
return true
})
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"ExpandAll",
"(",
")",
"*",
"TreeNode",
"{",
"n",
".",
"Walk",
"(",
"func",
"(",
"node",
",",
"parent",
"*",
"TreeNode",
")",
"bool",
"{",
"node",
".",
"expanded",
"=",
"true",
"\n",
"return",
"true",
"\n",
... | // ExpandAll expands this node and all descendent nodes. | [
"ExpandAll",
"expands",
"this",
"node",
"and",
"all",
"descendent",
"nodes",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L163-L169 |
163,810 | rivo/tview | treeview.go | CollapseAll | func (n *TreeNode) CollapseAll() *TreeNode {
n.Walk(func(node, parent *TreeNode) bool {
n.expanded = false
return true
})
return n
} | go | func (n *TreeNode) CollapseAll() *TreeNode {
n.Walk(func(node, parent *TreeNode) bool {
n.expanded = false
return true
})
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"CollapseAll",
"(",
")",
"*",
"TreeNode",
"{",
"n",
".",
"Walk",
"(",
"func",
"(",
"node",
",",
"parent",
"*",
"TreeNode",
")",
"bool",
"{",
"n",
".",
"expanded",
"=",
"false",
"\n",
"return",
"true",
"\n",
... | // CollapseAll collapses this node and all descendent nodes. | [
"CollapseAll",
"collapses",
"this",
"node",
"and",
"all",
"descendent",
"nodes",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L172-L178 |
163,811 | rivo/tview | treeview.go | SetText | func (n *TreeNode) SetText(text string) *TreeNode {
n.text = text
return n
} | go | func (n *TreeNode) SetText(text string) *TreeNode {
n.text = text
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"SetText",
"(",
"text",
"string",
")",
"*",
"TreeNode",
"{",
"n",
".",
"text",
"=",
"text",
"\n",
"return",
"n",
"\n",
"}"
] | // SetText sets the node's text which is displayed. | [
"SetText",
"sets",
"the",
"node",
"s",
"text",
"which",
"is",
"displayed",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L186-L189 |
163,812 | rivo/tview | treeview.go | SetColor | func (n *TreeNode) SetColor(color tcell.Color) *TreeNode {
n.color = color
return n
} | go | func (n *TreeNode) SetColor(color tcell.Color) *TreeNode {
n.color = color
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"SetColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"TreeNode",
"{",
"n",
".",
"color",
"=",
"color",
"\n",
"return",
"n",
"\n",
"}"
] | // SetColor sets the node's text color. | [
"SetColor",
"sets",
"the",
"node",
"s",
"text",
"color",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L197-L200 |
163,813 | rivo/tview | treeview.go | SetIndent | func (n *TreeNode) SetIndent(indent int) *TreeNode {
n.indent = indent
return n
} | go | func (n *TreeNode) SetIndent(indent int) *TreeNode {
n.indent = indent
return n
} | [
"func",
"(",
"n",
"*",
"TreeNode",
")",
"SetIndent",
"(",
"indent",
"int",
")",
"*",
"TreeNode",
"{",
"n",
".",
"indent",
"=",
"indent",
"\n",
"return",
"n",
"\n",
"}"
] | // SetIndent sets an additional indentation for this node's text. A value of 0
// keeps the text as far left as possible with a minimum of line graphics. Any
// value greater than that moves the text to the right. | [
"SetIndent",
"sets",
"an",
"additional",
"indentation",
"for",
"this",
"node",
"s",
"text",
".",
"A",
"value",
"of",
"0",
"keeps",
"the",
"text",
"as",
"far",
"left",
"as",
"possible",
"with",
"a",
"minimum",
"of",
"line",
"graphics",
".",
"Any",
"value"... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L205-L208 |
163,814 | rivo/tview | treeview.go | NewTreeView | func NewTreeView() *TreeView {
return &TreeView{
Box: NewBox(),
graphics: true,
graphicsColor: Styles.GraphicsColor,
}
} | go | func NewTreeView() *TreeView {
return &TreeView{
Box: NewBox(),
graphics: true,
graphicsColor: Styles.GraphicsColor,
}
} | [
"func",
"NewTreeView",
"(",
")",
"*",
"TreeView",
"{",
"return",
"&",
"TreeView",
"{",
"Box",
":",
"NewBox",
"(",
")",
",",
"graphics",
":",
"true",
",",
"graphicsColor",
":",
"Styles",
".",
"GraphicsColor",
",",
"}",
"\n",
"}"
] | // NewTreeView returns a new tree view. | [
"NewTreeView",
"returns",
"a",
"new",
"tree",
"view",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L285-L291 |
163,815 | rivo/tview | treeview.go | SetRoot | func (t *TreeView) SetRoot(root *TreeNode) *TreeView {
t.root = root
return t
} | go | func (t *TreeView) SetRoot(root *TreeNode) *TreeView {
t.root = root
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetRoot",
"(",
"root",
"*",
"TreeNode",
")",
"*",
"TreeView",
"{",
"t",
".",
"root",
"=",
"root",
"\n",
"return",
"t",
"\n",
"}"
] | // SetRoot sets the root node of the tree. | [
"SetRoot",
"sets",
"the",
"root",
"node",
"of",
"the",
"tree",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L294-L297 |
163,816 | rivo/tview | treeview.go | SetCurrentNode | func (t *TreeView) SetCurrentNode(node *TreeNode) *TreeView {
t.currentNode = node
return t
} | go | func (t *TreeView) SetCurrentNode(node *TreeNode) *TreeView {
t.currentNode = node
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetCurrentNode",
"(",
"node",
"*",
"TreeNode",
")",
"*",
"TreeView",
"{",
"t",
".",
"currentNode",
"=",
"node",
"\n",
"return",
"t",
"\n",
"}"
] | // SetCurrentNode sets the currently selected node. Provide nil to clear all
// selections. Selected nodes must be visible and selectable, or else the
// selection will be changed to the top-most selectable and visible node.
//
// This function does NOT trigger the "changed" callback. | [
"SetCurrentNode",
"sets",
"the",
"currently",
"selected",
"node",
".",
"Provide",
"nil",
"to",
"clear",
"all",
"selections",
".",
"Selected",
"nodes",
"must",
"be",
"visible",
"and",
"selectable",
"or",
"else",
"the",
"selection",
"will",
"be",
"changed",
"to"... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L310-L313 |
163,817 | rivo/tview | treeview.go | SetTopLevel | func (t *TreeView) SetTopLevel(topLevel int) *TreeView {
t.topLevel = topLevel
return t
} | go | func (t *TreeView) SetTopLevel(topLevel int) *TreeView {
t.topLevel = topLevel
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetTopLevel",
"(",
"topLevel",
"int",
")",
"*",
"TreeView",
"{",
"t",
".",
"topLevel",
"=",
"topLevel",
"\n",
"return",
"t",
"\n",
"}"
] | // SetTopLevel sets the first tree level that is visible with 0 referring to the
// root, 1 to the root's child nodes, and so on. Nodes above the top level are
// not displayed. | [
"SetTopLevel",
"sets",
"the",
"first",
"tree",
"level",
"that",
"is",
"visible",
"with",
"0",
"referring",
"to",
"the",
"root",
"1",
"to",
"the",
"root",
"s",
"child",
"nodes",
"and",
"so",
"on",
".",
"Nodes",
"above",
"the",
"top",
"level",
"are",
"no... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L324-L327 |
163,818 | rivo/tview | treeview.go | SetAlign | func (t *TreeView) SetAlign(align bool) *TreeView {
t.align = align
return t
} | go | func (t *TreeView) SetAlign(align bool) *TreeView {
t.align = align
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetAlign",
"(",
"align",
"bool",
")",
"*",
"TreeView",
"{",
"t",
".",
"align",
"=",
"align",
"\n",
"return",
"t",
"\n",
"}"
] | // SetAlign controls the horizontal alignment of the node texts. If set to true,
// all texts except that of top-level nodes will be placed in the same column.
// If set to false, they will indent with the hierarchy. | [
"SetAlign",
"controls",
"the",
"horizontal",
"alignment",
"of",
"the",
"node",
"texts",
".",
"If",
"set",
"to",
"true",
"all",
"texts",
"except",
"that",
"of",
"top",
"-",
"level",
"nodes",
"will",
"be",
"placed",
"in",
"the",
"same",
"column",
".",
"If"... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L346-L349 |
163,819 | rivo/tview | treeview.go | SetGraphics | func (t *TreeView) SetGraphics(showGraphics bool) *TreeView {
t.graphics = showGraphics
return t
} | go | func (t *TreeView) SetGraphics(showGraphics bool) *TreeView {
t.graphics = showGraphics
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetGraphics",
"(",
"showGraphics",
"bool",
")",
"*",
"TreeView",
"{",
"t",
".",
"graphics",
"=",
"showGraphics",
"\n",
"return",
"t",
"\n",
"}"
] | // SetGraphics sets a flag which determines whether or not line graphics are
// drawn to illustrate the tree's hierarchy. | [
"SetGraphics",
"sets",
"a",
"flag",
"which",
"determines",
"whether",
"or",
"not",
"line",
"graphics",
"are",
"drawn",
"to",
"illustrate",
"the",
"tree",
"s",
"hierarchy",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L353-L356 |
163,820 | rivo/tview | treeview.go | SetGraphicsColor | func (t *TreeView) SetGraphicsColor(color tcell.Color) *TreeView {
t.graphicsColor = color
return t
} | go | func (t *TreeView) SetGraphicsColor(color tcell.Color) *TreeView {
t.graphicsColor = color
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetGraphicsColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"TreeView",
"{",
"t",
".",
"graphicsColor",
"=",
"color",
"\n",
"return",
"t",
"\n",
"}"
] | // SetGraphicsColor sets the colors of the lines used to draw the tree structure. | [
"SetGraphicsColor",
"sets",
"the",
"colors",
"of",
"the",
"lines",
"used",
"to",
"draw",
"the",
"tree",
"structure",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L359-L362 |
163,821 | rivo/tview | treeview.go | SetChangedFunc | func (t *TreeView) SetChangedFunc(handler func(node *TreeNode)) *TreeView {
t.changed = handler
return t
} | go | func (t *TreeView) SetChangedFunc(handler func(node *TreeNode)) *TreeView {
t.changed = handler
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetChangedFunc",
"(",
"handler",
"func",
"(",
"node",
"*",
"TreeNode",
")",
")",
"*",
"TreeView",
"{",
"t",
".",
"changed",
"=",
"handler",
"\n",
"return",
"t",
"\n",
"}"
] | // SetChangedFunc sets the function which is called when the user navigates to
// a new tree node. | [
"SetChangedFunc",
"sets",
"the",
"function",
"which",
"is",
"called",
"when",
"the",
"user",
"navigates",
"to",
"a",
"new",
"tree",
"node",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L366-L369 |
163,822 | rivo/tview | treeview.go | SetSelectedFunc | func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView {
t.selected = handler
return t
} | go | func (t *TreeView) SetSelectedFunc(handler func(node *TreeNode)) *TreeView {
t.selected = handler
return t
} | [
"func",
"(",
"t",
"*",
"TreeView",
")",
"SetSelectedFunc",
"(",
"handler",
"func",
"(",
"node",
"*",
"TreeNode",
")",
")",
"*",
"TreeView",
"{",
"t",
".",
"selected",
"=",
"handler",
"\n",
"return",
"t",
"\n",
"}"
] | // SetSelectedFunc sets the function which is called when the user selects a
// node by pressing Enter on the current selection. | [
"SetSelectedFunc",
"sets",
"the",
"function",
"which",
"is",
"called",
"when",
"the",
"user",
"selects",
"a",
"node",
"by",
"pressing",
"Enter",
"on",
"the",
"current",
"selection",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/treeview.go#L373-L376 |
163,823 | rivo/tview | ansi.go | ANSIWriter | func ANSIWriter(writer io.Writer) io.Writer {
return &ansi{
Writer: writer,
buffer: new(bytes.Buffer),
csiParameter: new(bytes.Buffer),
csiIntermediate: new(bytes.Buffer),
state: ansiText,
}
} | go | func ANSIWriter(writer io.Writer) io.Writer {
return &ansi{
Writer: writer,
buffer: new(bytes.Buffer),
csiParameter: new(bytes.Buffer),
csiIntermediate: new(bytes.Buffer),
state: ansiText,
}
} | [
"func",
"ANSIWriter",
"(",
"writer",
"io",
".",
"Writer",
")",
"io",
".",
"Writer",
"{",
"return",
"&",
"ansi",
"{",
"Writer",
":",
"writer",
",",
"buffer",
":",
"new",
"(",
"bytes",
".",
"Buffer",
")",
",",
"csiParameter",
":",
"new",
"(",
"bytes",
... | // 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. | [
"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... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/ansi.go#L36-L44 |
163,824 | rivo/tview | ansi.go | TranslateANSI | func TranslateANSI(text string) string {
var buffer bytes.Buffer
writer := ANSIWriter(&buffer)
writer.Write([]byte(text))
return buffer.String()
} | go | func TranslateANSI(text string) string {
var buffer bytes.Buffer
writer := ANSIWriter(&buffer)
writer.Write([]byte(text))
return buffer.String()
} | [
"func",
"TranslateANSI",
"(",
"text",
"string",
")",
"string",
"{",
"var",
"buffer",
"bytes",
".",
"Buffer",
"\n",
"writer",
":=",
"ANSIWriter",
"(",
"&",
"buffer",
")",
"\n",
"writer",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"text",
")",
")",
"\n"... | // TranslateANSI replaces ANSI escape sequences found in the provided string
// with tview's color tags and returns the resulting string. | [
"TranslateANSI",
"replaces",
"ANSI",
"escape",
"sequences",
"found",
"in",
"the",
"provided",
"string",
"with",
"tview",
"s",
"color",
"tags",
"and",
"returns",
"the",
"resulting",
"string",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/ansi.go#L232-L237 |
163,825 | rivo/tview | dropdown.go | NewDropDown | func NewDropDown() *DropDown {
list := NewList().ShowSecondaryText(false)
list.SetMainTextColor(Styles.PrimitiveBackgroundColor).
SetSelectedTextColor(Styles.PrimitiveBackgroundColor).
SetSelectedBackgroundColor(Styles.PrimaryTextColor).
SetBackgroundColor(Styles.MoreContrastBackgroundColor)
d := &DropDown{
... | go | func NewDropDown() *DropDown {
list := NewList().ShowSecondaryText(false)
list.SetMainTextColor(Styles.PrimitiveBackgroundColor).
SetSelectedTextColor(Styles.PrimitiveBackgroundColor).
SetSelectedBackgroundColor(Styles.PrimaryTextColor).
SetBackgroundColor(Styles.MoreContrastBackgroundColor)
d := &DropDown{
... | [
"func",
"NewDropDown",
"(",
")",
"*",
"DropDown",
"{",
"list",
":=",
"NewList",
"(",
")",
".",
"ShowSecondaryText",
"(",
"false",
")",
"\n",
"list",
".",
"SetMainTextColor",
"(",
"Styles",
".",
"PrimitiveBackgroundColor",
")",
".",
"SetSelectedTextColor",
"(",... | // NewDropDown returns a new drop-down. | [
"NewDropDown",
"returns",
"a",
"new",
"drop",
"-",
"down",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L76-L96 |
163,826 | rivo/tview | dropdown.go | GetCurrentOption | func (d *DropDown) GetCurrentOption() (int, string) {
var text string
if d.currentOption >= 0 && d.currentOption < len(d.options) {
text = d.options[d.currentOption].Text
}
return d.currentOption, text
} | go | func (d *DropDown) GetCurrentOption() (int, string) {
var text string
if d.currentOption >= 0 && d.currentOption < len(d.options) {
text = d.options[d.currentOption].Text
}
return d.currentOption, text
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"GetCurrentOption",
"(",
")",
"(",
"int",
",",
"string",
")",
"{",
"var",
"text",
"string",
"\n",
"if",
"d",
".",
"currentOption",
">=",
"0",
"&&",
"d",
".",
"currentOption",
"<",
"len",
"(",
"d",
".",
"optio... | // GetCurrentOption returns the index of the currently selected option as well
// as its text. If no option was selected, -1 and an empty string is returned. | [
"GetCurrentOption",
"returns",
"the",
"index",
"of",
"the",
"currently",
"selected",
"option",
"as",
"well",
"as",
"its",
"text",
".",
"If",
"no",
"option",
"was",
"selected",
"-",
"1",
"and",
"an",
"empty",
"string",
"is",
"returned",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L123-L129 |
163,827 | rivo/tview | dropdown.go | SetFieldBackgroundColor | func (d *DropDown) SetFieldBackgroundColor(color tcell.Color) *DropDown {
d.fieldBackgroundColor = color
return d
} | go | func (d *DropDown) SetFieldBackgroundColor(color tcell.Color) *DropDown {
d.fieldBackgroundColor = color
return d
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"SetFieldBackgroundColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"DropDown",
"{",
"d",
".",
"fieldBackgroundColor",
"=",
"color",
"\n",
"return",
"d",
"\n",
"}"
] | // SetFieldBackgroundColor sets the background color of the options area. | [
"SetFieldBackgroundColor",
"sets",
"the",
"background",
"color",
"of",
"the",
"options",
"area",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L156-L159 |
163,828 | rivo/tview | dropdown.go | SetFieldTextColor | func (d *DropDown) SetFieldTextColor(color tcell.Color) *DropDown {
d.fieldTextColor = color
return d
} | go | func (d *DropDown) SetFieldTextColor(color tcell.Color) *DropDown {
d.fieldTextColor = color
return d
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"SetFieldTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"DropDown",
"{",
"d",
".",
"fieldTextColor",
"=",
"color",
"\n",
"return",
"d",
"\n",
"}"
] | // SetFieldTextColor sets the text color of the options area. | [
"SetFieldTextColor",
"sets",
"the",
"text",
"color",
"of",
"the",
"options",
"area",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L162-L165 |
163,829 | rivo/tview | dropdown.go | SetPrefixTextColor | func (d *DropDown) SetPrefixTextColor(color tcell.Color) *DropDown {
d.prefixTextColor = color
return d
} | go | func (d *DropDown) SetPrefixTextColor(color tcell.Color) *DropDown {
d.prefixTextColor = color
return d
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"SetPrefixTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"DropDown",
"{",
"d",
".",
"prefixTextColor",
"=",
"color",
"\n",
"return",
"d",
"\n",
"}"
] | // SetPrefixTextColor sets the color of the prefix string. The prefix string is
// shown when the user starts typing text, which directly selects the first
// option that starts with the typed string. | [
"SetPrefixTextColor",
"sets",
"the",
"color",
"of",
"the",
"prefix",
"string",
".",
"The",
"prefix",
"string",
"is",
"shown",
"when",
"the",
"user",
"starts",
"typing",
"text",
"which",
"directly",
"selects",
"the",
"first",
"option",
"that",
"starts",
"with",... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L170-L173 |
163,830 | rivo/tview | dropdown.go | SetFieldWidth | func (d *DropDown) SetFieldWidth(width int) *DropDown {
d.fieldWidth = width
return d
} | go | func (d *DropDown) SetFieldWidth(width int) *DropDown {
d.fieldWidth = width
return d
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"SetFieldWidth",
"(",
"width",
"int",
")",
"*",
"DropDown",
"{",
"d",
".",
"fieldWidth",
"=",
"width",
"\n",
"return",
"d",
"\n",
"}"
] | // SetFieldWidth sets the screen width of the options area. A value of 0 means
// extend to as long as the longest option text. | [
"SetFieldWidth",
"sets",
"the",
"screen",
"width",
"of",
"the",
"options",
"area",
".",
"A",
"value",
"of",
"0",
"means",
"extend",
"to",
"as",
"long",
"as",
"the",
"longest",
"option",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L187-L190 |
163,831 | rivo/tview | dropdown.go | GetFieldWidth | func (d *DropDown) GetFieldWidth() int {
if d.fieldWidth > 0 {
return d.fieldWidth
}
fieldWidth := 0
for _, option := range d.options {
width := TaggedStringWidth(option.Text)
if width > fieldWidth {
fieldWidth = width
}
}
return fieldWidth
} | go | func (d *DropDown) GetFieldWidth() int {
if d.fieldWidth > 0 {
return d.fieldWidth
}
fieldWidth := 0
for _, option := range d.options {
width := TaggedStringWidth(option.Text)
if width > fieldWidth {
fieldWidth = width
}
}
return fieldWidth
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"GetFieldWidth",
"(",
")",
"int",
"{",
"if",
"d",
".",
"fieldWidth",
">",
"0",
"{",
"return",
"d",
".",
"fieldWidth",
"\n",
"}",
"\n",
"fieldWidth",
":=",
"0",
"\n",
"for",
"_",
",",
"option",
":=",
"range",
... | // GetFieldWidth returns this primitive's field screen width. | [
"GetFieldWidth",
"returns",
"this",
"primitive",
"s",
"field",
"screen",
"width",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L193-L205 |
163,832 | rivo/tview | dropdown.go | AddOption | func (d *DropDown) AddOption(text string, selected func()) *DropDown {
d.options = append(d.options, &dropDownOption{Text: text, Selected: selected})
d.list.AddItem(text, "", 0, nil)
return d
} | go | func (d *DropDown) AddOption(text string, selected func()) *DropDown {
d.options = append(d.options, &dropDownOption{Text: text, Selected: selected})
d.list.AddItem(text, "", 0, nil)
return d
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"AddOption",
"(",
"text",
"string",
",",
"selected",
"func",
"(",
")",
")",
"*",
"DropDown",
"{",
"d",
".",
"options",
"=",
"append",
"(",
"d",
".",
"options",
",",
"&",
"dropDownOption",
"{",
"Text",
":",
"t... | // AddOption adds a new selectable option to this drop-down. The "selected"
// callback is called when this option was selected. It may be nil. | [
"AddOption",
"adds",
"a",
"new",
"selectable",
"option",
"to",
"this",
"drop",
"-",
"down",
".",
"The",
"selected",
"callback",
"is",
"called",
"when",
"this",
"option",
"was",
"selected",
".",
"It",
"may",
"be",
"nil",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L209-L213 |
163,833 | rivo/tview | dropdown.go | SetOptions | func (d *DropDown) SetOptions(texts []string, selected func(text string, index int)) *DropDown {
d.list.Clear()
d.options = nil
for index, text := range texts {
func(t string, i int) {
d.AddOption(text, nil)
}(text, index)
}
d.selected = selected
return d
} | go | func (d *DropDown) SetOptions(texts []string, selected func(text string, index int)) *DropDown {
d.list.Clear()
d.options = nil
for index, text := range texts {
func(t string, i int) {
d.AddOption(text, nil)
}(text, index)
}
d.selected = selected
return d
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"SetOptions",
"(",
"texts",
"[",
"]",
"string",
",",
"selected",
"func",
"(",
"text",
"string",
",",
"index",
"int",
")",
")",
"*",
"DropDown",
"{",
"d",
".",
"list",
".",
"Clear",
"(",
")",
"\n",
"d",
".",... | // SetOptions replaces all current options with the ones provided and installs
// one callback function which is called when one of the options is selected.
// It will be called with the option's text and its index into the options
// slice. The "selected" parameter may be nil. | [
"SetOptions",
"replaces",
"all",
"current",
"options",
"with",
"the",
"ones",
"provided",
"and",
"installs",
"one",
"callback",
"function",
"which",
"is",
"called",
"when",
"one",
"of",
"the",
"options",
"is",
"selected",
".",
"It",
"will",
"be",
"called",
"... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L219-L229 |
163,834 | rivo/tview | dropdown.go | SetSelectedFunc | func (d *DropDown) SetSelectedFunc(handler func(text string, index int)) *DropDown {
d.selected = handler
return d
} | go | func (d *DropDown) SetSelectedFunc(handler func(text string, index int)) *DropDown {
d.selected = handler
return d
} | [
"func",
"(",
"d",
"*",
"DropDown",
")",
"SetSelectedFunc",
"(",
"handler",
"func",
"(",
"text",
"string",
",",
"index",
"int",
")",
")",
"*",
"DropDown",
"{",
"d",
".",
"selected",
"=",
"handler",
"\n",
"return",
"d",
"\n",
"}"
] | // SetSelectedFunc sets a handler which is called when the user changes the
// drop-down's option. This handler will be called in addition and prior to
// an option's optional individual handler. The handler is provided with the
// selected option's text and index. If "no option" was selected, these values
// are an em... | [
"SetSelectedFunc",
"sets",
"a",
"handler",
"which",
"is",
"called",
"when",
"the",
"user",
"changes",
"the",
"drop",
"-",
"down",
"s",
"option",
".",
"This",
"handler",
"will",
"be",
"called",
"in",
"addition",
"and",
"prior",
"to",
"an",
"option",
"s",
... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/dropdown.go#L236-L239 |
163,835 | rivo/tview | util.go | init | func init() {
// We'll use zero width joiners.
runewidth.ZeroWidthJoiner = true
// Initialize the predefined input field handlers.
InputFieldInteger = func(text string, ch rune) bool {
if text == "-" {
return true
}
_, err := strconv.Atoi(text)
return err == nil
}
InputFieldFloat = func(text string, c... | go | func init() {
// We'll use zero width joiners.
runewidth.ZeroWidthJoiner = true
// Initialize the predefined input field handlers.
InputFieldInteger = func(text string, ch rune) bool {
if text == "-" {
return true
}
_, err := strconv.Atoi(text)
return err == nil
}
InputFieldFloat = func(text string, c... | [
"func",
"init",
"(",
")",
"{",
"// We'll use zero width joiners.",
"runewidth",
".",
"ZeroWidthJoiner",
"=",
"true",
"\n\n",
"// Initialize the predefined input field handlers.",
"InputFieldInteger",
"=",
"func",
"(",
"text",
"string",
",",
"ch",
"rune",
")",
"bool",
... | // Package initialization. | [
"Package",
"initialization",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/util.go#L54-L78 |
163,836 | rivo/tview | util.go | PrintSimple | func PrintSimple(screen tcell.Screen, text string, x, y int) {
Print(screen, text, x, y, math.MaxInt32, AlignLeft, Styles.PrimaryTextColor)
} | go | func PrintSimple(screen tcell.Screen, text string, x, y int) {
Print(screen, text, x, y, math.MaxInt32, AlignLeft, Styles.PrimaryTextColor)
} | [
"func",
"PrintSimple",
"(",
"screen",
"tcell",
".",
"Screen",
",",
"text",
"string",
",",
"x",
",",
"y",
"int",
")",
"{",
"Print",
"(",
"screen",
",",
"text",
",",
"x",
",",
"y",
",",
"math",
".",
"MaxInt32",
",",
"AlignLeft",
",",
"Styles",
".",
... | // PrintSimple prints white text to the screen at the given position. | [
"PrintSimple",
"prints",
"white",
"text",
"to",
"the",
"screen",
"at",
"the",
"given",
"position",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/util.go#L408-L410 |
163,837 | rivo/tview | util.go | TaggedStringWidth | func TaggedStringWidth(text string) int {
_, _, _, _, _, _, width := decomposeString(text, true, false)
return width
} | go | func TaggedStringWidth(text string) int {
_, _, _, _, _, _, width := decomposeString(text, true, false)
return width
} | [
"func",
"TaggedStringWidth",
"(",
"text",
"string",
")",
"int",
"{",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"_",
",",
"width",
":=",
"decomposeString",
"(",
"text",
",",
"true",
",",
"false",
")",
"\n",
"return",
"width",
"\n",
"}"
] | // TaggedStringWidth returns the width of the given string needed to print it on
// screen. The text may contain color tags which are not counted. | [
"TaggedStringWidth",
"returns",
"the",
"width",
"of",
"the",
"given",
"string",
"needed",
"to",
"print",
"it",
"on",
"screen",
".",
"The",
"text",
"may",
"contain",
"color",
"tags",
"which",
"are",
"not",
"counted",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/util.go#L414-L417 |
163,838 | rivo/tview | util.go | stringWidth | func stringWidth(text string) (width int) {
g := uniseg.NewGraphemes(text)
for g.Next() {
var chWidth int
for _, r := range g.Runes() {
chWidth = runewidth.RuneWidth(r)
if chWidth > 0 {
break // Our best guess at this point is to use the width of the first non-zero-width rune.
}
}
width += chWidt... | go | func stringWidth(text string) (width int) {
g := uniseg.NewGraphemes(text)
for g.Next() {
var chWidth int
for _, r := range g.Runes() {
chWidth = runewidth.RuneWidth(r)
if chWidth > 0 {
break // Our best guess at this point is to use the width of the first non-zero-width rune.
}
}
width += chWidt... | [
"func",
"stringWidth",
"(",
"text",
"string",
")",
"(",
"width",
"int",
")",
"{",
"g",
":=",
"uniseg",
".",
"NewGraphemes",
"(",
"text",
")",
"\n",
"for",
"g",
".",
"Next",
"(",
")",
"{",
"var",
"chWidth",
"int",
"\n",
"for",
"_",
",",
"r",
":=",... | // stringWidth returns the number of horizontal cells needed to print the given
// text. It splits the text into its grapheme clusters, calculates each
// cluster's width, and adds them up to a total. | [
"stringWidth",
"returns",
"the",
"number",
"of",
"horizontal",
"cells",
"needed",
"to",
"print",
"the",
"given",
"text",
".",
"It",
"splits",
"the",
"text",
"into",
"its",
"grapheme",
"clusters",
"calculates",
"each",
"cluster",
"s",
"width",
"and",
"adds",
... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/util.go#L422-L435 |
163,839 | rivo/tview | inputfield.go | NewInputField | func NewInputField() *InputField {
return &InputField{
Box: NewBox(),
labelColor: Styles.SecondaryTextColor,
fieldBackgroundColor: Styles.ContrastBackgroundColor,
fieldTextColor: Styles.PrimaryTextColor,
placeholderTextColor: Styles.ContrastSecondaryTextColor,
}
} | go | func NewInputField() *InputField {
return &InputField{
Box: NewBox(),
labelColor: Styles.SecondaryTextColor,
fieldBackgroundColor: Styles.ContrastBackgroundColor,
fieldTextColor: Styles.PrimaryTextColor,
placeholderTextColor: Styles.ContrastSecondaryTextColor,
}
} | [
"func",
"NewInputField",
"(",
")",
"*",
"InputField",
"{",
"return",
"&",
"InputField",
"{",
"Box",
":",
"NewBox",
"(",
")",
",",
"labelColor",
":",
"Styles",
".",
"SecondaryTextColor",
",",
"fieldBackgroundColor",
":",
"Styles",
".",
"ContrastBackgroundColor",
... | // NewInputField returns a new input field. | [
"NewInputField",
"returns",
"a",
"new",
"input",
"field",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/inputfield.go#L91-L99 |
163,840 | rivo/tview | inputfield.go | SetText | func (i *InputField) SetText(text string) *InputField {
i.text = text
i.cursorPos = len(text)
if i.changed != nil {
i.changed(text)
}
return i
} | go | func (i *InputField) SetText(text string) *InputField {
i.text = text
i.cursorPos = len(text)
if i.changed != nil {
i.changed(text)
}
return i
} | [
"func",
"(",
"i",
"*",
"InputField",
")",
"SetText",
"(",
"text",
"string",
")",
"*",
"InputField",
"{",
"i",
".",
"text",
"=",
"text",
"\n",
"i",
".",
"cursorPos",
"=",
"len",
"(",
"text",
")",
"\n",
"if",
"i",
".",
"changed",
"!=",
"nil",
"{",
... | // SetText sets the current text of the input field. | [
"SetText",
"sets",
"the",
"current",
"text",
"of",
"the",
"input",
"field",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/inputfield.go#L102-L109 |
163,841 | rivo/tview | inputfield.go | SetPlaceholder | func (i *InputField) SetPlaceholder(text string) *InputField {
i.placeholder = text
return i
} | go | func (i *InputField) SetPlaceholder(text string) *InputField {
i.placeholder = text
return i
} | [
"func",
"(",
"i",
"*",
"InputField",
")",
"SetPlaceholder",
"(",
"text",
"string",
")",
"*",
"InputField",
"{",
"i",
".",
"placeholder",
"=",
"text",
"\n",
"return",
"i",
"\n",
"}"
] | // SetPlaceholder sets the text to be displayed when the input text is empty. | [
"SetPlaceholder",
"sets",
"the",
"text",
"to",
"be",
"displayed",
"when",
"the",
"input",
"text",
"is",
"empty",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/inputfield.go#L135-L138 |
163,842 | rivo/tview | inputfield.go | SetPlaceholderTextColor | func (i *InputField) SetPlaceholderTextColor(color tcell.Color) *InputField {
i.placeholderTextColor = color
return i
} | go | func (i *InputField) SetPlaceholderTextColor(color tcell.Color) *InputField {
i.placeholderTextColor = color
return i
} | [
"func",
"(",
"i",
"*",
"InputField",
")",
"SetPlaceholderTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"InputField",
"{",
"i",
".",
"placeholderTextColor",
"=",
"color",
"\n",
"return",
"i",
"\n",
"}"
] | // SetPlaceholderTextColor sets the text color of placeholder text. | [
"SetPlaceholderTextColor",
"sets",
"the",
"text",
"color",
"of",
"placeholder",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/inputfield.go#L159-L162 |
163,843 | rivo/tview | inputfield.go | SetFieldWidth | func (i *InputField) SetFieldWidth(width int) *InputField {
i.fieldWidth = width
return i
} | go | func (i *InputField) SetFieldWidth(width int) *InputField {
i.fieldWidth = width
return i
} | [
"func",
"(",
"i",
"*",
"InputField",
")",
"SetFieldWidth",
"(",
"width",
"int",
")",
"*",
"InputField",
"{",
"i",
".",
"fieldWidth",
"=",
"width",
"\n",
"return",
"i",
"\n",
"}"
] | // SetFieldWidth sets the screen width of the input area. A value of 0 means
// extend as much as possible. | [
"SetFieldWidth",
"sets",
"the",
"screen",
"width",
"of",
"the",
"input",
"area",
".",
"A",
"value",
"of",
"0",
"means",
"extend",
"as",
"much",
"as",
"possible",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/inputfield.go#L176-L179 |
163,844 | rivo/tview | inputfield.go | SetMaskCharacter | func (i *InputField) SetMaskCharacter(mask rune) *InputField {
i.maskCharacter = mask
return i
} | go | func (i *InputField) SetMaskCharacter(mask rune) *InputField {
i.maskCharacter = mask
return i
} | [
"func",
"(",
"i",
"*",
"InputField",
")",
"SetMaskCharacter",
"(",
"mask",
"rune",
")",
"*",
"InputField",
"{",
"i",
".",
"maskCharacter",
"=",
"mask",
"\n",
"return",
"i",
"\n",
"}"
] | // SetMaskCharacter sets a character that masks user input on a screen. A value
// of 0 disables masking. | [
"SetMaskCharacter",
"sets",
"a",
"character",
"that",
"masks",
"user",
"input",
"on",
"a",
"screen",
".",
"A",
"value",
"of",
"0",
"disables",
"masking",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/inputfield.go#L188-L191 |
163,845 | rivo/tview | demos/unicode/main.go | alert | func alert(pages *tview.Pages, id string, message string) *tview.Pages {
return pages.AddPage(
id,
tview.NewModal().
SetText(message).
AddButtons([]string{"确定"}).
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
pages.HidePage(id).RemovePage(id)
}),
false,
true,
)
} | go | func alert(pages *tview.Pages, id string, message string) *tview.Pages {
return pages.AddPage(
id,
tview.NewModal().
SetText(message).
AddButtons([]string{"确定"}).
SetDoneFunc(func(buttonIndex int, buttonLabel string) {
pages.HidePage(id).RemovePage(id)
}),
false,
true,
)
} | [
"func",
"alert",
"(",
"pages",
"*",
"tview",
".",
"Pages",
",",
"id",
"string",
",",
"message",
"string",
")",
"*",
"tview",
".",
"Pages",
"{",
"return",
"pages",
".",
"AddPage",
"(",
"id",
",",
"tview",
".",
"NewModal",
"(",
")",
".",
"SetText",
"... | // alert shows a confirmation dialog. | [
"alert",
"shows",
"a",
"confirmation",
"dialog",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/unicode/main.go#L37-L49 |
163,846 | rivo/tview | button.go | NewButton | func NewButton(label string) *Button {
box := NewBox().SetBackgroundColor(Styles.ContrastBackgroundColor)
box.SetRect(0, 0, TaggedStringWidth(label)+4, 1)
return &Button{
Box: box,
label: label,
labelColor: Styles.PrimaryTextColor,
labelColorActivated: ... | go | func NewButton(label string) *Button {
box := NewBox().SetBackgroundColor(Styles.ContrastBackgroundColor)
box.SetRect(0, 0, TaggedStringWidth(label)+4, 1)
return &Button{
Box: box,
label: label,
labelColor: Styles.PrimaryTextColor,
labelColorActivated: ... | [
"func",
"NewButton",
"(",
"label",
"string",
")",
"*",
"Button",
"{",
"box",
":=",
"NewBox",
"(",
")",
".",
"SetBackgroundColor",
"(",
"Styles",
".",
"ContrastBackgroundColor",
")",
"\n",
"box",
".",
"SetRect",
"(",
"0",
",",
"0",
",",
"TaggedStringWidth",... | // NewButton returns a new input field. | [
"NewButton",
"returns",
"a",
"new",
"input",
"field",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/button.go#L34-L44 |
163,847 | rivo/tview | button.go | SetLabel | func (b *Button) SetLabel(label string) *Button {
b.label = label
return b
} | go | func (b *Button) SetLabel(label string) *Button {
b.label = label
return b
} | [
"func",
"(",
"b",
"*",
"Button",
")",
"SetLabel",
"(",
"label",
"string",
")",
"*",
"Button",
"{",
"b",
".",
"label",
"=",
"label",
"\n",
"return",
"b",
"\n",
"}"
] | // SetLabel sets the button text. | [
"SetLabel",
"sets",
"the",
"button",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/button.go#L47-L50 |
163,848 | rivo/tview | button.go | SetLabelColor | func (b *Button) SetLabelColor(color tcell.Color) *Button {
b.labelColor = color
return b
} | go | func (b *Button) SetLabelColor(color tcell.Color) *Button {
b.labelColor = color
return b
} | [
"func",
"(",
"b",
"*",
"Button",
")",
"SetLabelColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"Button",
"{",
"b",
".",
"labelColor",
"=",
"color",
"\n",
"return",
"b",
"\n",
"}"
] | // SetLabelColor sets the color of the button text. | [
"SetLabelColor",
"sets",
"the",
"color",
"of",
"the",
"button",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/button.go#L58-L61 |
163,849 | rivo/tview | button.go | SetLabelColorActivated | func (b *Button) SetLabelColorActivated(color tcell.Color) *Button {
b.labelColorActivated = color
return b
} | go | func (b *Button) SetLabelColorActivated(color tcell.Color) *Button {
b.labelColorActivated = color
return b
} | [
"func",
"(",
"b",
"*",
"Button",
")",
"SetLabelColorActivated",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"Button",
"{",
"b",
".",
"labelColorActivated",
"=",
"color",
"\n",
"return",
"b",
"\n",
"}"
] | // SetLabelColorActivated sets the color of the button text when the button is
// in focus. | [
"SetLabelColorActivated",
"sets",
"the",
"color",
"of",
"the",
"button",
"text",
"when",
"the",
"button",
"is",
"in",
"focus",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/button.go#L65-L68 |
163,850 | rivo/tview | button.go | SetBackgroundColorActivated | func (b *Button) SetBackgroundColorActivated(color tcell.Color) *Button {
b.backgroundColorActivated = color
return b
} | go | func (b *Button) SetBackgroundColorActivated(color tcell.Color) *Button {
b.backgroundColorActivated = color
return b
} | [
"func",
"(",
"b",
"*",
"Button",
")",
"SetBackgroundColorActivated",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"Button",
"{",
"b",
".",
"backgroundColorActivated",
"=",
"color",
"\n",
"return",
"b",
"\n",
"}"
] | // SetBackgroundColorActivated sets the background color of the button text when
// the button is in focus. | [
"SetBackgroundColorActivated",
"sets",
"the",
"background",
"color",
"of",
"the",
"button",
"text",
"when",
"the",
"button",
"is",
"in",
"focus",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/button.go#L72-L75 |
163,851 | rivo/tview | demos/presentation/form.go | Form | func Form(nextSlide func()) (title string, content tview.Primitive) {
f := tview.NewForm().
AddInputField("First name:", "", 20, nil, nil).
AddInputField("Last name:", "", 20, nil, nil).
AddDropDown("Role:", []string{"Engineer", "Manager", "Administration"}, 0, nil).
AddCheckbox("On vacation:", false, nil).
... | go | func Form(nextSlide func()) (title string, content tview.Primitive) {
f := tview.NewForm().
AddInputField("First name:", "", 20, nil, nil).
AddInputField("Last name:", "", 20, nil, nil).
AddDropDown("Role:", []string{"Engineer", "Manager", "Administration"}, 0, nil).
AddCheckbox("On vacation:", false, nil).
... | [
"func",
"Form",
"(",
"nextSlide",
"func",
"(",
")",
")",
"(",
"title",
"string",
",",
"content",
"tview",
".",
"Primitive",
")",
"{",
"f",
":=",
"tview",
".",
"NewForm",
"(",
")",
".",
"AddInputField",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"20",
... | // Form demonstrates forms. | [
"Form",
"demonstrates",
"forms",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/presentation/form.go#L32-L43 |
163,852 | rivo/tview | demos/presentation/grid.go | Grid | func Grid(nextSlide func()) (title string, content tview.Primitive) {
modalShown := false
pages := tview.NewPages()
newPrimitive := func(text string) tview.Primitive {
return tview.NewTextView().
SetTextAlign(tview.AlignCenter).
SetText(text).
SetDoneFunc(func(key tcell.Key) {
if modalShown {
ne... | go | func Grid(nextSlide func()) (title string, content tview.Primitive) {
modalShown := false
pages := tview.NewPages()
newPrimitive := func(text string) tview.Primitive {
return tview.NewTextView().
SetTextAlign(tview.AlignCenter).
SetText(text).
SetDoneFunc(func(key tcell.Key) {
if modalShown {
ne... | [
"func",
"Grid",
"(",
"nextSlide",
"func",
"(",
")",
")",
"(",
"title",
"string",
",",
"content",
"tview",
".",
"Primitive",
")",
"{",
"modalShown",
":=",
"false",
"\n",
"pages",
":=",
"tview",
".",
"NewPages",
"(",
")",
"\n\n",
"newPrimitive",
":=",
"f... | // Grid demonstrates the grid layout. | [
"Grid",
"demonstrates",
"the",
"grid",
"layout",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/presentation/grid.go#L9-L59 |
163,853 | rivo/tview | modal.go | NewModal | func NewModal() *Modal {
m := &Modal{
Box: NewBox(),
textColor: Styles.PrimaryTextColor,
}
m.form = NewForm().
SetButtonsAlign(AlignCenter).
SetButtonBackgroundColor(Styles.PrimitiveBackgroundColor).
SetButtonTextColor(Styles.PrimaryTextColor)
m.form.SetBackgroundColor(Styles.ContrastBackgroundColor... | go | func NewModal() *Modal {
m := &Modal{
Box: NewBox(),
textColor: Styles.PrimaryTextColor,
}
m.form = NewForm().
SetButtonsAlign(AlignCenter).
SetButtonBackgroundColor(Styles.PrimitiveBackgroundColor).
SetButtonTextColor(Styles.PrimaryTextColor)
m.form.SetBackgroundColor(Styles.ContrastBackgroundColor... | [
"func",
"NewModal",
"(",
")",
"*",
"Modal",
"{",
"m",
":=",
"&",
"Modal",
"{",
"Box",
":",
"NewBox",
"(",
")",
",",
"textColor",
":",
"Styles",
".",
"PrimaryTextColor",
",",
"}",
"\n",
"m",
".",
"form",
"=",
"NewForm",
"(",
")",
".",
"SetButtonsAli... | // NewModal returns a new modal message window. | [
"NewModal",
"returns",
"a",
"new",
"modal",
"message",
"window",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/modal.go#L33-L54 |
163,854 | rivo/tview | modal.go | SetTextColor | func (m *Modal) SetTextColor(color tcell.Color) *Modal {
m.textColor = color
return m
} | go | func (m *Modal) SetTextColor(color tcell.Color) *Modal {
m.textColor = color
return m
} | [
"func",
"(",
"m",
"*",
"Modal",
")",
"SetTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"Modal",
"{",
"m",
".",
"textColor",
"=",
"color",
"\n",
"return",
"m",
"\n",
"}"
] | // SetTextColor sets the color of the message text. | [
"SetTextColor",
"sets",
"the",
"color",
"of",
"the",
"message",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/modal.go#L57-L60 |
163,855 | rivo/tview | modal.go | SetDoneFunc | func (m *Modal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *Modal {
m.done = handler
return m
} | go | func (m *Modal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *Modal {
m.done = handler
return m
} | [
"func",
"(",
"m",
"*",
"Modal",
")",
"SetDoneFunc",
"(",
"handler",
"func",
"(",
"buttonIndex",
"int",
",",
"buttonLabel",
"string",
")",
")",
"*",
"Modal",
"{",
"m",
".",
"done",
"=",
"handler",
"\n",
"return",
"m",
"\n",
"}"
] | // SetDoneFunc sets a handler which is called when one of the buttons was
// pressed. It receives the index of the button as well as its label text. The
// handler is also called when the user presses the Escape key. The index will
// then be negative and the label text an emptry string. | [
"SetDoneFunc",
"sets",
"a",
"handler",
"which",
"is",
"called",
"when",
"one",
"of",
"the",
"buttons",
"was",
"pressed",
".",
"It",
"receives",
"the",
"index",
"of",
"the",
"button",
"as",
"well",
"as",
"its",
"label",
"text",
".",
"The",
"handler",
"is"... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/modal.go#L66-L69 |
163,856 | rivo/tview | modal.go | SetText | func (m *Modal) SetText(text string) *Modal {
m.text = text
return m
} | go | func (m *Modal) SetText(text string) *Modal {
m.text = text
return m
} | [
"func",
"(",
"m",
"*",
"Modal",
")",
"SetText",
"(",
"text",
"string",
")",
"*",
"Modal",
"{",
"m",
".",
"text",
"=",
"text",
"\n",
"return",
"m",
"\n",
"}"
] | // SetText sets the message text of the window. The text may contain line
// breaks. Note that words are wrapped, too, based on the final size of the
// window. | [
"SetText",
"sets",
"the",
"message",
"text",
"of",
"the",
"window",
".",
"The",
"text",
"may",
"contain",
"line",
"breaks",
".",
"Note",
"that",
"words",
"are",
"wrapped",
"too",
"based",
"on",
"the",
"final",
"size",
"of",
"the",
"window",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/modal.go#L74-L77 |
163,857 | rivo/tview | modal.go | AddButtons | func (m *Modal) AddButtons(labels []string) *Modal {
for index, label := range labels {
func(i int, l string) {
m.form.AddButton(label, func() {
if m.done != nil {
m.done(i, l)
}
})
button := m.form.GetButton(m.form.GetButtonCount() - 1)
button.SetInputCapture(func(event *tcell.EventKey) *tc... | go | func (m *Modal) AddButtons(labels []string) *Modal {
for index, label := range labels {
func(i int, l string) {
m.form.AddButton(label, func() {
if m.done != nil {
m.done(i, l)
}
})
button := m.form.GetButton(m.form.GetButtonCount() - 1)
button.SetInputCapture(func(event *tcell.EventKey) *tc... | [
"func",
"(",
"m",
"*",
"Modal",
")",
"AddButtons",
"(",
"labels",
"[",
"]",
"string",
")",
"*",
"Modal",
"{",
"for",
"index",
",",
"label",
":=",
"range",
"labels",
"{",
"func",
"(",
"i",
"int",
",",
"l",
"string",
")",
"{",
"m",
".",
"form",
"... | // AddButtons adds buttons to the window. There must be at least one button and
// a "done" handler so the window can be closed again. | [
"AddButtons",
"adds",
"buttons",
"to",
"the",
"window",
".",
"There",
"must",
"be",
"at",
"least",
"one",
"button",
"and",
"a",
"done",
"handler",
"so",
"the",
"window",
"can",
"be",
"closed",
"again",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/modal.go#L81-L102 |
163,858 | rivo/tview | demos/presentation/center.go | Center | func Center(width, height int, p tview.Primitive) tview.Primitive {
return tview.NewFlex().
AddItem(tview.NewBox(), 0, 1, false).
AddItem(tview.NewFlex().
SetDirection(tview.FlexRow).
AddItem(tview.NewBox(), 0, 1, false).
AddItem(p, height, 1, true).
AddItem(tview.NewBox(), 0, 1, false), width, 1, true... | go | func Center(width, height int, p tview.Primitive) tview.Primitive {
return tview.NewFlex().
AddItem(tview.NewBox(), 0, 1, false).
AddItem(tview.NewFlex().
SetDirection(tview.FlexRow).
AddItem(tview.NewBox(), 0, 1, false).
AddItem(p, height, 1, true).
AddItem(tview.NewBox(), 0, 1, false), width, 1, true... | [
"func",
"Center",
"(",
"width",
",",
"height",
"int",
",",
"p",
"tview",
".",
"Primitive",
")",
"tview",
".",
"Primitive",
"{",
"return",
"tview",
".",
"NewFlex",
"(",
")",
".",
"AddItem",
"(",
"tview",
".",
"NewBox",
"(",
")",
",",
"0",
",",
"1",
... | // Center returns a new primitive which shows the provided primitive in its
// center, given the provided primitive's size. | [
"Center",
"returns",
"a",
"new",
"primitive",
"which",
"shows",
"the",
"provided",
"primitive",
"in",
"its",
"center",
"given",
"the",
"provided",
"primitive",
"s",
"size",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/presentation/center.go#L7-L16 |
163,859 | rivo/tview | demos/treeview/main.go | main | func main() {
rootDir := "."
root := tview.NewTreeNode(rootDir).
SetColor(tcell.ColorRed)
tree := tview.NewTreeView().
SetRoot(root).
SetCurrentNode(root)
// A helper function which adds the files and directories of the given path
// to the given target node.
add := func(target *tview.TreeNode, path string... | go | func main() {
rootDir := "."
root := tview.NewTreeNode(rootDir).
SetColor(tcell.ColorRed)
tree := tview.NewTreeView().
SetRoot(root).
SetCurrentNode(root)
// A helper function which adds the files and directories of the given path
// to the given target node.
add := func(target *tview.TreeNode, path string... | [
"func",
"main",
"(",
")",
"{",
"rootDir",
":=",
"\"",
"\"",
"\n",
"root",
":=",
"tview",
".",
"NewTreeNode",
"(",
"rootDir",
")",
".",
"SetColor",
"(",
"tcell",
".",
"ColorRed",
")",
"\n",
"tree",
":=",
"tview",
".",
"NewTreeView",
"(",
")",
".",
"... | // Show a navigable tree view of the current directory. | [
"Show",
"a",
"navigable",
"tree",
"view",
"of",
"the",
"current",
"directory",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/treeview/main.go#L13-L62 |
163,860 | rivo/tview | demos/presentation/textview.go | TextView1 | func TextView1(nextSlide func()) (title string, content tview.Primitive) {
textView := tview.NewTextView().
SetTextColor(tcell.ColorYellow).
SetScrollable(false).
SetDoneFunc(func(key tcell.Key) {
nextSlide()
})
textView.SetChangedFunc(func() {
if textView.HasFocus() {
app.Draw()
}
})
go func() {
... | go | func TextView1(nextSlide func()) (title string, content tview.Primitive) {
textView := tview.NewTextView().
SetTextColor(tcell.ColorYellow).
SetScrollable(false).
SetDoneFunc(func(key tcell.Key) {
nextSlide()
})
textView.SetChangedFunc(func() {
if textView.HasFocus() {
app.Draw()
}
})
go func() {
... | [
"func",
"TextView1",
"(",
"nextSlide",
"func",
"(",
")",
")",
"(",
"title",
"string",
",",
"content",
"tview",
".",
"Primitive",
")",
"{",
"textView",
":=",
"tview",
".",
"NewTextView",
"(",
")",
".",
"SetTextColor",
"(",
"tcell",
".",
"ColorYellow",
")"... | // TextView1 demonstrates the basic text view. | [
"TextView1",
"demonstrates",
"the",
"basic",
"text",
"view",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/presentation/textview.go#L33-L55 |
163,861 | rivo/tview | demos/presentation/textview.go | TextView2 | func TextView2(nextSlide func()) (title string, content tview.Primitive) {
codeView := tview.NewTextView().
SetWrap(false)
fmt.Fprint(codeView, textView2)
codeView.SetBorder(true).SetTitle("Buffer content")
textView := tview.NewTextView()
textView.SetDynamicColors(true).
SetWrap(false).
SetRegions(true).
... | go | func TextView2(nextSlide func()) (title string, content tview.Primitive) {
codeView := tview.NewTextView().
SetWrap(false)
fmt.Fprint(codeView, textView2)
codeView.SetBorder(true).SetTitle("Buffer content")
textView := tview.NewTextView()
textView.SetDynamicColors(true).
SetWrap(false).
SetRegions(true).
... | [
"func",
"TextView2",
"(",
"nextSlide",
"func",
"(",
")",
")",
"(",
"title",
"string",
",",
"content",
"tview",
".",
"Primitive",
")",
"{",
"codeView",
":=",
"tview",
".",
"NewTextView",
"(",
")",
".",
"SetWrap",
"(",
"false",
")",
"\n",
"fmt",
".",
"... | // TextView2 demonstrates the extended text view. | [
"TextView2",
"demonstrates",
"the",
"extended",
"text",
"view",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/presentation/textview.go#L105-L151 |
163,862 | rivo/tview | frame.go | NewFrame | func NewFrame(primitive Primitive) *Frame {
box := NewBox()
f := &Frame{
Box: box,
primitive: primitive,
top: 1,
bottom: 1,
header: 1,
footer: 1,
left: 1,
right: 1,
}
f.focus = f
return f
} | go | func NewFrame(primitive Primitive) *Frame {
box := NewBox()
f := &Frame{
Box: box,
primitive: primitive,
top: 1,
bottom: 1,
header: 1,
footer: 1,
left: 1,
right: 1,
}
f.focus = f
return f
} | [
"func",
"NewFrame",
"(",
"primitive",
"Primitive",
")",
"*",
"Frame",
"{",
"box",
":=",
"NewBox",
"(",
")",
"\n\n",
"f",
":=",
"&",
"Frame",
"{",
"Box",
":",
"box",
",",
"primitive",
":",
"primitive",
",",
"top",
":",
"1",
",",
"bottom",
":",
"1",
... | // NewFrame returns a new frame around the given primitive. The primitive's
// size will be changed to fit within this frame. | [
"NewFrame",
"returns",
"a",
"new",
"frame",
"around",
"the",
"given",
"primitive",
".",
"The",
"primitive",
"s",
"size",
"will",
"be",
"changed",
"to",
"fit",
"within",
"this",
"frame",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/frame.go#L34-L51 |
163,863 | rivo/tview | frame.go | AddText | func (f *Frame) AddText(text string, header bool, align int, color tcell.Color) *Frame {
f.text = append(f.text, &frameText{
Text: text,
Header: header,
Align: align,
Color: color,
})
return f
} | go | func (f *Frame) AddText(text string, header bool, align int, color tcell.Color) *Frame {
f.text = append(f.text, &frameText{
Text: text,
Header: header,
Align: align,
Color: color,
})
return f
} | [
"func",
"(",
"f",
"*",
"Frame",
")",
"AddText",
"(",
"text",
"string",
",",
"header",
"bool",
",",
"align",
"int",
",",
"color",
"tcell",
".",
"Color",
")",
"*",
"Frame",
"{",
"f",
".",
"text",
"=",
"append",
"(",
"f",
".",
"text",
",",
"&",
"f... | // 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
// appear in the footer, below the contained primitive. "align" must be one of
// the Align constants. Rows in the header are printed top to bottom, rows in
// the ... | [
"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",
"appear... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/frame.go#L59-L67 |
163,864 | rivo/tview | list.go | NewList | func NewList() *List {
return &List{
Box: NewBox(),
showSecondaryText: true,
mainTextColor: Styles.PrimaryTextColor,
secondaryTextColor: Styles.TertiaryTextColor,
shortcutColor: Styles.SecondaryTextColor,
selectedTextColor: Styles.PrimitiveBackground... | go | func NewList() *List {
return &List{
Box: NewBox(),
showSecondaryText: true,
mainTextColor: Styles.PrimaryTextColor,
secondaryTextColor: Styles.TertiaryTextColor,
shortcutColor: Styles.SecondaryTextColor,
selectedTextColor: Styles.PrimitiveBackground... | [
"func",
"NewList",
"(",
")",
"*",
"List",
"{",
"return",
"&",
"List",
"{",
"Box",
":",
"NewBox",
"(",
")",
",",
"showSecondaryText",
":",
"true",
",",
"mainTextColor",
":",
"Styles",
".",
"PrimaryTextColor",
",",
"secondaryTextColor",
":",
"Styles",
".",
... | // NewList returns a new form. | [
"NewList",
"returns",
"a",
"new",
"form",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L70-L80 |
163,865 | rivo/tview | list.go | SetMainTextColor | func (l *List) SetMainTextColor(color tcell.Color) *List {
l.mainTextColor = color
return l
} | go | func (l *List) SetMainTextColor(color tcell.Color) *List {
l.mainTextColor = color
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetMainTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"List",
"{",
"l",
".",
"mainTextColor",
"=",
"color",
"\n",
"return",
"l",
"\n",
"}"
] | // SetMainTextColor sets the color of the items' main text. | [
"SetMainTextColor",
"sets",
"the",
"color",
"of",
"the",
"items",
"main",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L162-L165 |
163,866 | rivo/tview | list.go | SetSecondaryTextColor | func (l *List) SetSecondaryTextColor(color tcell.Color) *List {
l.secondaryTextColor = color
return l
} | go | func (l *List) SetSecondaryTextColor(color tcell.Color) *List {
l.secondaryTextColor = color
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetSecondaryTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"List",
"{",
"l",
".",
"secondaryTextColor",
"=",
"color",
"\n",
"return",
"l",
"\n",
"}"
] | // SetSecondaryTextColor sets the color of the items' secondary text. | [
"SetSecondaryTextColor",
"sets",
"the",
"color",
"of",
"the",
"items",
"secondary",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L168-L171 |
163,867 | rivo/tview | list.go | SetShortcutColor | func (l *List) SetShortcutColor(color tcell.Color) *List {
l.shortcutColor = color
return l
} | go | func (l *List) SetShortcutColor(color tcell.Color) *List {
l.shortcutColor = color
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetShortcutColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"List",
"{",
"l",
".",
"shortcutColor",
"=",
"color",
"\n",
"return",
"l",
"\n",
"}"
] | // SetShortcutColor sets the color of the items' shortcut. | [
"SetShortcutColor",
"sets",
"the",
"color",
"of",
"the",
"items",
"shortcut",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L174-L177 |
163,868 | rivo/tview | list.go | SetSelectedTextColor | func (l *List) SetSelectedTextColor(color tcell.Color) *List {
l.selectedTextColor = color
return l
} | go | func (l *List) SetSelectedTextColor(color tcell.Color) *List {
l.selectedTextColor = color
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetSelectedTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"List",
"{",
"l",
".",
"selectedTextColor",
"=",
"color",
"\n",
"return",
"l",
"\n",
"}"
] | // SetSelectedTextColor sets the text color of selected items. | [
"SetSelectedTextColor",
"sets",
"the",
"text",
"color",
"of",
"selected",
"items",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L180-L183 |
163,869 | rivo/tview | list.go | SetSelectedBackgroundColor | func (l *List) SetSelectedBackgroundColor(color tcell.Color) *List {
l.selectedBackgroundColor = color
return l
} | go | func (l *List) SetSelectedBackgroundColor(color tcell.Color) *List {
l.selectedBackgroundColor = color
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetSelectedBackgroundColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"List",
"{",
"l",
".",
"selectedBackgroundColor",
"=",
"color",
"\n",
"return",
"l",
"\n",
"}"
] | // SetSelectedBackgroundColor sets the background color of selected items. | [
"SetSelectedBackgroundColor",
"sets",
"the",
"background",
"color",
"of",
"selected",
"items",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L186-L189 |
163,870 | rivo/tview | list.go | SetSelectedFocusOnly | func (l *List) SetSelectedFocusOnly(focusOnly bool) *List {
l.selectedFocusOnly = focusOnly
return l
} | go | func (l *List) SetSelectedFocusOnly(focusOnly bool) *List {
l.selectedFocusOnly = focusOnly
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetSelectedFocusOnly",
"(",
"focusOnly",
"bool",
")",
"*",
"List",
"{",
"l",
".",
"selectedFocusOnly",
"=",
"focusOnly",
"\n",
"return",
"l",
"\n",
"}"
] | // SetSelectedFocusOnly sets a flag which determines when the currently selected
// list item is highlighted. If set to true, selected items are only highlighted
// when the list has focus. If set to false, they are always highlighted. | [
"SetSelectedFocusOnly",
"sets",
"a",
"flag",
"which",
"determines",
"when",
"the",
"currently",
"selected",
"list",
"item",
"is",
"highlighted",
".",
"If",
"set",
"to",
"true",
"selected",
"items",
"are",
"only",
"highlighted",
"when",
"the",
"list",
"has",
"f... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L194-L197 |
163,871 | rivo/tview | list.go | SetHighlightFullLine | func (l *List) SetHighlightFullLine(highlight bool) *List {
l.highlightFullLine = highlight
return l
} | go | func (l *List) SetHighlightFullLine(highlight bool) *List {
l.highlightFullLine = highlight
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetHighlightFullLine",
"(",
"highlight",
"bool",
")",
"*",
"List",
"{",
"l",
".",
"highlightFullLine",
"=",
"highlight",
"\n",
"return",
"l",
"\n",
"}"
] | // SetHighlightFullLine sets a flag which determines whether the colored
// background of selected items spans the entire width of the view. If set to
// true, the highlight spans the entire view. If set to false, only the text of
// the selected item from beginning to end is highlighted. | [
"SetHighlightFullLine",
"sets",
"a",
"flag",
"which",
"determines",
"whether",
"the",
"colored",
"background",
"of",
"selected",
"items",
"spans",
"the",
"entire",
"width",
"of",
"the",
"view",
".",
"If",
"set",
"to",
"true",
"the",
"highlight",
"spans",
"the"... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L203-L206 |
163,872 | rivo/tview | list.go | ShowSecondaryText | func (l *List) ShowSecondaryText(show bool) *List {
l.showSecondaryText = show
return l
} | go | func (l *List) ShowSecondaryText(show bool) *List {
l.showSecondaryText = show
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"ShowSecondaryText",
"(",
"show",
"bool",
")",
"*",
"List",
"{",
"l",
".",
"showSecondaryText",
"=",
"show",
"\n",
"return",
"l",
"\n",
"}"
] | // ShowSecondaryText determines whether or not to show secondary item texts. | [
"ShowSecondaryText",
"determines",
"whether",
"or",
"not",
"to",
"show",
"secondary",
"item",
"texts",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L209-L212 |
163,873 | rivo/tview | list.go | SetItemText | func (l *List) SetItemText(index int, main, secondary string) *List {
item := l.items[index]
item.MainText = main
item.SecondaryText = secondary
return l
} | go | func (l *List) SetItemText(index int, main, secondary string) *List {
item := l.items[index]
item.MainText = main
item.SecondaryText = secondary
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"SetItemText",
"(",
"index",
"int",
",",
"main",
",",
"secondary",
"string",
")",
"*",
"List",
"{",
"item",
":=",
"l",
".",
"items",
"[",
"index",
"]",
"\n",
"item",
".",
"MainText",
"=",
"main",
"\n",
"item",
... | // SetItemText sets an item's main and secondary text. Panics if the index is
// out of range. | [
"SetItemText",
"sets",
"an",
"item",
"s",
"main",
"and",
"secondary",
"text",
".",
"Panics",
"if",
"the",
"index",
"is",
"out",
"of",
"range",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L321-L326 |
163,874 | rivo/tview | list.go | FindItems | func (l *List) FindItems(mainSearch, secondarySearch string, mustContainBoth, ignoreCase bool) (indices []int) {
if mainSearch == "" && secondarySearch == "" {
return
}
if ignoreCase {
mainSearch = strings.ToLower(mainSearch)
secondarySearch = strings.ToLower(secondarySearch)
}
for index, item := range l.i... | go | func (l *List) FindItems(mainSearch, secondarySearch string, mustContainBoth, ignoreCase bool) (indices []int) {
if mainSearch == "" && secondarySearch == "" {
return
}
if ignoreCase {
mainSearch = strings.ToLower(mainSearch)
secondarySearch = strings.ToLower(secondarySearch)
}
for index, item := range l.i... | [
"func",
"(",
"l",
"*",
"List",
")",
"FindItems",
"(",
"mainSearch",
",",
"secondarySearch",
"string",
",",
"mustContainBoth",
",",
"ignoreCase",
"bool",
")",
"(",
"indices",
"[",
"]",
"int",
")",
"{",
"if",
"mainSearch",
"==",
"\"",
"\"",
"&&",
"secondar... | // FindItems searches the main and secondary texts for the given strings and
// returns a list of item indices in which those strings are found. One of the
// two search strings may be empty, it will then be ignored. Indices are always
// returned in ascending order.
//
// If mustContainBoth is set to true, mainSearch ... | [
"FindItems",
"searches",
"the",
"main",
"and",
"secondary",
"texts",
"for",
"the",
"given",
"strings",
"and",
"returns",
"a",
"list",
"of",
"item",
"indices",
"in",
"which",
"those",
"strings",
"are",
"found",
".",
"One",
"of",
"the",
"two",
"search",
"str... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L338-L366 |
163,875 | rivo/tview | list.go | Clear | func (l *List) Clear() *List {
l.items = nil
l.currentItem = 0
return l
} | go | func (l *List) Clear() *List {
l.items = nil
l.currentItem = 0
return l
} | [
"func",
"(",
"l",
"*",
"List",
")",
"Clear",
"(",
")",
"*",
"List",
"{",
"l",
".",
"items",
"=",
"nil",
"\n",
"l",
".",
"currentItem",
"=",
"0",
"\n",
"return",
"l",
"\n",
"}"
] | // Clear removes all items from the list. | [
"Clear",
"removes",
"all",
"items",
"from",
"the",
"list",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/list.go#L369-L373 |
163,876 | rivo/tview | flex.go | SetFullScreen | func (f *Flex) SetFullScreen(fullScreen bool) *Flex {
f.fullScreen = fullScreen
return f
} | go | func (f *Flex) SetFullScreen(fullScreen bool) *Flex {
f.fullScreen = fullScreen
return f
} | [
"func",
"(",
"f",
"*",
"Flex",
")",
"SetFullScreen",
"(",
"fullScreen",
"bool",
")",
"*",
"Flex",
"{",
"f",
".",
"fullScreen",
"=",
"fullScreen",
"\n",
"return",
"f",
"\n",
"}"
] | // SetFullScreen sets the flag which, when true, causes the flex layout to use
// the entire screen space instead of whatever size it is currently assigned to. | [
"SetFullScreen",
"sets",
"the",
"flag",
"which",
"when",
"true",
"causes",
"the",
"flex",
"layout",
"to",
"use",
"the",
"entire",
"screen",
"space",
"instead",
"of",
"whatever",
"size",
"it",
"is",
"currently",
"assigned",
"to",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/flex.go#L69-L72 |
163,877 | rivo/tview | flex.go | RemoveItem | func (f *Flex) RemoveItem(p Primitive) *Flex {
for index := len(f.items) - 1; index >= 0; index-- {
if f.items[index].Item == p {
f.items = append(f.items[:index], f.items[index+1:]...)
}
}
return f
} | go | func (f *Flex) RemoveItem(p Primitive) *Flex {
for index := len(f.items) - 1; index >= 0; index-- {
if f.items[index].Item == p {
f.items = append(f.items[:index], f.items[index+1:]...)
}
}
return f
} | [
"func",
"(",
"f",
"*",
"Flex",
")",
"RemoveItem",
"(",
"p",
"Primitive",
")",
"*",
"Flex",
"{",
"for",
"index",
":=",
"len",
"(",
"f",
".",
"items",
")",
"-",
"1",
";",
"index",
">=",
"0",
";",
"index",
"--",
"{",
"if",
"f",
".",
"items",
"["... | // RemoveItem removes all items for the given primitive from the container,
// keeping the order of the remaining items intact. | [
"RemoveItem",
"removes",
"all",
"items",
"for",
"the",
"given",
"primitive",
"from",
"the",
"container",
"keeping",
"the",
"order",
"of",
"the",
"remaining",
"items",
"intact",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/flex.go#L95-L102 |
163,878 | rivo/tview | checkbox.go | NewCheckbox | func NewCheckbox() *Checkbox {
return &Checkbox{
Box: NewBox(),
labelColor: Styles.SecondaryTextColor,
fieldBackgroundColor: Styles.ContrastBackgroundColor,
fieldTextColor: Styles.PrimaryTextColor,
}
} | go | func NewCheckbox() *Checkbox {
return &Checkbox{
Box: NewBox(),
labelColor: Styles.SecondaryTextColor,
fieldBackgroundColor: Styles.ContrastBackgroundColor,
fieldTextColor: Styles.PrimaryTextColor,
}
} | [
"func",
"NewCheckbox",
"(",
")",
"*",
"Checkbox",
"{",
"return",
"&",
"Checkbox",
"{",
"Box",
":",
"NewBox",
"(",
")",
",",
"labelColor",
":",
"Styles",
".",
"SecondaryTextColor",
",",
"fieldBackgroundColor",
":",
"Styles",
".",
"ContrastBackgroundColor",
",",... | // NewCheckbox returns a new input field. | [
"NewCheckbox",
"returns",
"a",
"new",
"input",
"field",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/checkbox.go#L48-L55 |
163,879 | rivo/tview | checkbox.go | SetChecked | func (c *Checkbox) SetChecked(checked bool) *Checkbox {
c.checked = checked
return c
} | go | func (c *Checkbox) SetChecked(checked bool) *Checkbox {
c.checked = checked
return c
} | [
"func",
"(",
"c",
"*",
"Checkbox",
")",
"SetChecked",
"(",
"checked",
"bool",
")",
"*",
"Checkbox",
"{",
"c",
".",
"checked",
"=",
"checked",
"\n",
"return",
"c",
"\n",
"}"
] | // SetChecked sets the state of the checkbox. | [
"SetChecked",
"sets",
"the",
"state",
"of",
"the",
"checkbox",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/checkbox.go#L58-L61 |
163,880 | rivo/tview | checkbox.go | SetChangedFunc | func (c *Checkbox) SetChangedFunc(handler func(checked bool)) *Checkbox {
c.changed = handler
return c
} | go | func (c *Checkbox) SetChangedFunc(handler func(checked bool)) *Checkbox {
c.changed = handler
return c
} | [
"func",
"(",
"c",
"*",
"Checkbox",
")",
"SetChangedFunc",
"(",
"handler",
"func",
"(",
"checked",
"bool",
")",
")",
"*",
"Checkbox",
"{",
"c",
".",
"changed",
"=",
"handler",
"\n",
"return",
"c",
"\n",
"}"
] | // SetChangedFunc sets a handler which is called when the checked state of this
// checkbox was changed by the user. The handler function receives the new
// state. | [
"SetChangedFunc",
"sets",
"a",
"handler",
"which",
"is",
"called",
"when",
"the",
"checked",
"state",
"of",
"this",
"checkbox",
"was",
"changed",
"by",
"the",
"user",
".",
"The",
"handler",
"function",
"receives",
"the",
"new",
"state",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/checkbox.go#L122-L125 |
163,881 | rivo/tview | demos/presentation/treeview.go | TreeView | func TreeView(nextSlide func()) (title string, content tview.Primitive) {
treeNextSlide = nextSlide
tree.SetBorder(true).
SetTitle("TreeView")
// Add nodes.
var add func(target *node) *tview.TreeNode
add = func(target *node) *tview.TreeNode {
node := tview.NewTreeNode(target.text).
SetSelectable(target.exp... | go | func TreeView(nextSlide func()) (title string, content tview.Primitive) {
treeNextSlide = nextSlide
tree.SetBorder(true).
SetTitle("TreeView")
// Add nodes.
var add func(target *node) *tview.TreeNode
add = func(target *node) *tview.TreeNode {
node := tview.NewTreeNode(target.text).
SetSelectable(target.exp... | [
"func",
"TreeView",
"(",
"nextSlide",
"func",
"(",
")",
")",
"(",
"title",
"string",
",",
"content",
"tview",
".",
"Primitive",
")",
"{",
"treeNextSlide",
"=",
"nextSlide",
"\n",
"tree",
".",
"SetBorder",
"(",
"true",
")",
".",
"SetTitle",
"(",
"\"",
"... | // TreeView demonstrates the tree view. | [
"TreeView",
"demonstrates",
"the",
"tree",
"view",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/demos/presentation/treeview.go#L109-L149 |
163,882 | rivo/tview | table.go | SetText | func (c *TableCell) SetText(text string) *TableCell {
c.Text = text
return c
} | go | func (c *TableCell) SetText(text string) *TableCell {
c.Text = text
return c
} | [
"func",
"(",
"c",
"*",
"TableCell",
")",
"SetText",
"(",
"text",
"string",
")",
"*",
"TableCell",
"{",
"c",
".",
"Text",
"=",
"text",
"\n",
"return",
"c",
"\n",
"}"
] | // SetText sets the cell's text. | [
"SetText",
"sets",
"the",
"cell",
"s",
"text",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L62-L65 |
163,883 | rivo/tview | table.go | SetAlign | func (c *TableCell) SetAlign(align int) *TableCell {
c.Align = align
return c
} | go | func (c *TableCell) SetAlign(align int) *TableCell {
c.Align = align
return c
} | [
"func",
"(",
"c",
"*",
"TableCell",
")",
"SetAlign",
"(",
"align",
"int",
")",
"*",
"TableCell",
"{",
"c",
".",
"Align",
"=",
"align",
"\n",
"return",
"c",
"\n",
"}"
] | // SetAlign sets the cell's text alignment, one of AlignLeft, AlignCenter, or
// AlignRight. | [
"SetAlign",
"sets",
"the",
"cell",
"s",
"text",
"alignment",
"one",
"of",
"AlignLeft",
"AlignCenter",
"or",
"AlignRight",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L69-L72 |
163,884 | rivo/tview | table.go | SetMaxWidth | func (c *TableCell) SetMaxWidth(maxWidth int) *TableCell {
c.MaxWidth = maxWidth
return c
} | go | func (c *TableCell) SetMaxWidth(maxWidth int) *TableCell {
c.MaxWidth = maxWidth
return c
} | [
"func",
"(",
"c",
"*",
"TableCell",
")",
"SetMaxWidth",
"(",
"maxWidth",
"int",
")",
"*",
"TableCell",
"{",
"c",
".",
"MaxWidth",
"=",
"maxWidth",
"\n",
"return",
"c",
"\n",
"}"
] | // SetMaxWidth sets maximum width of the cell in screen space. This is used to
// give a column a maximum width. Any cell text whose screen width exceeds this
// width is cut off. Set to 0 if there is no maximum width. | [
"SetMaxWidth",
"sets",
"maximum",
"width",
"of",
"the",
"cell",
"in",
"screen",
"space",
".",
"This",
"is",
"used",
"to",
"give",
"a",
"column",
"a",
"maximum",
"width",
".",
"Any",
"cell",
"text",
"whose",
"screen",
"width",
"exceeds",
"this",
"width",
... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L77-L80 |
163,885 | rivo/tview | table.go | SetTextColor | func (c *TableCell) SetTextColor(color tcell.Color) *TableCell {
c.Color = color
return c
} | go | func (c *TableCell) SetTextColor(color tcell.Color) *TableCell {
c.Color = color
return c
} | [
"func",
"(",
"c",
"*",
"TableCell",
")",
"SetTextColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"TableCell",
"{",
"c",
".",
"Color",
"=",
"color",
"\n",
"return",
"c",
"\n",
"}"
] | // SetTextColor sets the cell's text color. | [
"SetTextColor",
"sets",
"the",
"cell",
"s",
"text",
"color",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L104-L107 |
163,886 | rivo/tview | table.go | SetBackgroundColor | func (c *TableCell) SetBackgroundColor(color tcell.Color) *TableCell {
c.BackgroundColor = color
return c
} | go | func (c *TableCell) SetBackgroundColor(color tcell.Color) *TableCell {
c.BackgroundColor = color
return c
} | [
"func",
"(",
"c",
"*",
"TableCell",
")",
"SetBackgroundColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"TableCell",
"{",
"c",
".",
"BackgroundColor",
"=",
"color",
"\n",
"return",
"c",
"\n",
"}"
] | // SetBackgroundColor sets the cell's background color. Set to
// tcell.ColorDefault to use the table's background color. | [
"SetBackgroundColor",
"sets",
"the",
"cell",
"s",
"background",
"color",
".",
"Set",
"to",
"tcell",
".",
"ColorDefault",
"to",
"use",
"the",
"table",
"s",
"background",
"color",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L111-L114 |
163,887 | rivo/tview | table.go | SetSelectable | func (c *TableCell) SetSelectable(selectable bool) *TableCell {
c.NotSelectable = !selectable
return c
} | go | func (c *TableCell) SetSelectable(selectable bool) *TableCell {
c.NotSelectable = !selectable
return c
} | [
"func",
"(",
"c",
"*",
"TableCell",
")",
"SetSelectable",
"(",
"selectable",
"bool",
")",
"*",
"TableCell",
"{",
"c",
".",
"NotSelectable",
"=",
"!",
"selectable",
"\n",
"return",
"c",
"\n",
"}"
] | // SetSelectable sets whether or not this cell can be selected by the user. | [
"SetSelectable",
"sets",
"whether",
"or",
"not",
"this",
"cell",
"can",
"be",
"selected",
"by",
"the",
"user",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L133-L136 |
163,888 | rivo/tview | table.go | NewTable | func NewTable() *Table {
return &Table{
Box: NewBox(),
bordersColor: Styles.GraphicsColor,
separator: ' ',
lastColumn: -1,
}
} | go | func NewTable() *Table {
return &Table{
Box: NewBox(),
bordersColor: Styles.GraphicsColor,
separator: ' ',
lastColumn: -1,
}
} | [
"func",
"NewTable",
"(",
")",
"*",
"Table",
"{",
"return",
"&",
"Table",
"{",
"Box",
":",
"NewBox",
"(",
")",
",",
"bordersColor",
":",
"Styles",
".",
"GraphicsColor",
",",
"separator",
":",
"' '",
",",
"lastColumn",
":",
"-",
"1",
",",
"}",
"\n",
... | // NewTable returns a new table. | [
"NewTable",
"returns",
"a",
"new",
"table",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L270-L277 |
163,889 | rivo/tview | table.go | Clear | func (t *Table) Clear() *Table {
t.cells = nil
t.lastColumn = -1
return t
} | go | func (t *Table) Clear() *Table {
t.cells = nil
t.lastColumn = -1
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"Clear",
"(",
")",
"*",
"Table",
"{",
"t",
".",
"cells",
"=",
"nil",
"\n",
"t",
".",
"lastColumn",
"=",
"-",
"1",
"\n",
"return",
"t",
"\n",
"}"
] | // Clear removes all table data. | [
"Clear",
"removes",
"all",
"table",
"data",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L280-L284 |
163,890 | rivo/tview | table.go | SetBorders | func (t *Table) SetBorders(show bool) *Table {
t.borders = show
return t
} | go | func (t *Table) SetBorders(show bool) *Table {
t.borders = show
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"SetBorders",
"(",
"show",
"bool",
")",
"*",
"Table",
"{",
"t",
".",
"borders",
"=",
"show",
"\n",
"return",
"t",
"\n",
"}"
] | // SetBorders sets whether or not each cell in the table is surrounded by a
// border. | [
"SetBorders",
"sets",
"whether",
"or",
"not",
"each",
"cell",
"in",
"the",
"table",
"is",
"surrounded",
"by",
"a",
"border",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L288-L291 |
163,891 | rivo/tview | table.go | SetBordersColor | func (t *Table) SetBordersColor(color tcell.Color) *Table {
t.bordersColor = color
return t
} | go | func (t *Table) SetBordersColor(color tcell.Color) *Table {
t.bordersColor = color
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"SetBordersColor",
"(",
"color",
"tcell",
".",
"Color",
")",
"*",
"Table",
"{",
"t",
".",
"bordersColor",
"=",
"color",
"\n",
"return",
"t",
"\n",
"}"
] | // SetBordersColor sets the color of the cell borders. | [
"SetBordersColor",
"sets",
"the",
"color",
"of",
"the",
"cell",
"borders",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L294-L297 |
163,892 | rivo/tview | table.go | SetFixed | func (t *Table) SetFixed(rows, columns int) *Table {
t.fixedRows, t.fixedColumns = rows, columns
return t
} | go | func (t *Table) SetFixed(rows, columns int) *Table {
t.fixedRows, t.fixedColumns = rows, columns
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"SetFixed",
"(",
"rows",
",",
"columns",
"int",
")",
"*",
"Table",
"{",
"t",
".",
"fixedRows",
",",
"t",
".",
"fixedColumns",
"=",
"rows",
",",
"columns",
"\n",
"return",
"t",
"\n",
"}"
] | // SetFixed sets the number of fixed rows and columns which are always visible
// even when the rest of the cells are scrolled out of view. Rows are always the
// top-most ones. Columns are always the left-most ones. | [
"SetFixed",
"sets",
"the",
"number",
"of",
"fixed",
"rows",
"and",
"columns",
"which",
"are",
"always",
"visible",
"even",
"when",
"the",
"rest",
"of",
"the",
"cells",
"are",
"scrolled",
"out",
"of",
"view",
".",
"Rows",
"are",
"always",
"the",
"top",
"-... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L326-L329 |
163,893 | rivo/tview | table.go | GetSelection | func (t *Table) GetSelection() (row, column int) {
return t.selectedRow, t.selectedColumn
} | go | func (t *Table) GetSelection() (row, column int) {
return t.selectedRow, t.selectedColumn
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"GetSelection",
"(",
")",
"(",
"row",
",",
"column",
"int",
")",
"{",
"return",
"t",
".",
"selectedRow",
",",
"t",
".",
"selectedColumn",
"\n",
"}"
] | // GetSelection returns the position of the current selection.
// If entire rows are selected, the column index is undefined.
// Likewise for entire columns. | [
"GetSelection",
"returns",
"the",
"position",
"of",
"the",
"current",
"selection",
".",
"If",
"entire",
"rows",
"are",
"selected",
"the",
"column",
"index",
"is",
"undefined",
".",
"Likewise",
"for",
"entire",
"columns",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L352-L354 |
163,894 | rivo/tview | table.go | SetOffset | func (t *Table) SetOffset(row, column int) *Table {
t.rowOffset, t.columnOffset = row, column
t.trackEnd = false
return t
} | go | func (t *Table) SetOffset(row, column int) *Table {
t.rowOffset, t.columnOffset = row, column
t.trackEnd = false
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"SetOffset",
"(",
"row",
",",
"column",
"int",
")",
"*",
"Table",
"{",
"t",
".",
"rowOffset",
",",
"t",
".",
"columnOffset",
"=",
"row",
",",
"column",
"\n",
"t",
".",
"trackEnd",
"=",
"false",
"\n",
"return",
... | // SetOffset sets how many rows and columns should be skipped when drawing the
// table. This is useful for large tables that do not fit on the screen.
// Navigating a selection can change these values.
//
// Fixed rows and columns are never skipped. | [
"SetOffset",
"sets",
"how",
"many",
"rows",
"and",
"columns",
"should",
"be",
"skipped",
"when",
"drawing",
"the",
"table",
".",
"This",
"is",
"useful",
"for",
"large",
"tables",
"that",
"do",
"not",
"fit",
"on",
"the",
"screen",
".",
"Navigating",
"a",
... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L369-L373 |
163,895 | rivo/tview | table.go | GetOffset | func (t *Table) GetOffset() (row, column int) {
return t.rowOffset, t.columnOffset
} | go | func (t *Table) GetOffset() (row, column int) {
return t.rowOffset, t.columnOffset
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"GetOffset",
"(",
")",
"(",
"row",
",",
"column",
"int",
")",
"{",
"return",
"t",
".",
"rowOffset",
",",
"t",
".",
"columnOffset",
"\n",
"}"
] | // GetOffset returns the current row and column offset. This indicates how many
// rows and columns the table is scrolled down and to the right. | [
"GetOffset",
"returns",
"the",
"current",
"row",
"and",
"column",
"offset",
".",
"This",
"indicates",
"how",
"many",
"rows",
"and",
"columns",
"the",
"table",
"is",
"scrolled",
"down",
"and",
"to",
"the",
"right",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L377-L379 |
163,896 | rivo/tview | table.go | SetSelectionChangedFunc | func (t *Table) SetSelectionChangedFunc(handler func(row, column int)) *Table {
t.selectionChanged = handler
return t
} | go | func (t *Table) SetSelectionChangedFunc(handler func(row, column int)) *Table {
t.selectionChanged = handler
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"SetSelectionChangedFunc",
"(",
"handler",
"func",
"(",
"row",
",",
"column",
"int",
")",
")",
"*",
"Table",
"{",
"t",
".",
"selectionChanged",
"=",
"handler",
"\n",
"return",
"t",
"\n",
"}"
] | // SetSelectionChangedFunc sets a handler which is called whenever the user
// navigates to a new selection. The handler receives the position of the new
// selection. If entire rows are selected, the column index is undefined.
// Likewise for entire columns. | [
"SetSelectionChangedFunc",
"sets",
"a",
"handler",
"which",
"is",
"called",
"whenever",
"the",
"user",
"navigates",
"to",
"a",
"new",
"selection",
".",
"The",
"handler",
"receives",
"the",
"position",
"of",
"the",
"new",
"selection",
".",
"If",
"entire",
"rows... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L394-L397 |
163,897 | rivo/tview | table.go | GetCell | func (t *Table) GetCell(row, column int) *TableCell {
if row >= len(t.cells) || column >= len(t.cells[row]) {
return &TableCell{}
}
return t.cells[row][column]
} | go | func (t *Table) GetCell(row, column int) *TableCell {
if row >= len(t.cells) || column >= len(t.cells[row]) {
return &TableCell{}
}
return t.cells[row][column]
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"GetCell",
"(",
"row",
",",
"column",
"int",
")",
"*",
"TableCell",
"{",
"if",
"row",
">=",
"len",
"(",
"t",
".",
"cells",
")",
"||",
"column",
">=",
"len",
"(",
"t",
".",
"cells",
"[",
"row",
"]",
")",
"{... | // GetCell returns the contents of the cell at the specified position. A valid
// TableCell object is always returned but it will be uninitialized if the cell
// was not previously set. Such an uninitialized object will not automatically
// be inserted. Therefore, repeated calls to this function may return different
//... | [
"GetCell",
"returns",
"the",
"contents",
"of",
"the",
"cell",
"at",
"the",
"specified",
"position",
".",
"A",
"valid",
"TableCell",
"object",
"is",
"always",
"returned",
"but",
"it",
"will",
"be",
"uninitialized",
"if",
"the",
"cell",
"was",
"not",
"previous... | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L446-L451 |
163,898 | rivo/tview | table.go | RemoveRow | func (t *Table) RemoveRow(row int) *Table {
if row < 0 || row >= len(t.cells) {
return t
}
t.cells = append(t.cells[:row], t.cells[row+1:]...)
return t
} | go | func (t *Table) RemoveRow(row int) *Table {
if row < 0 || row >= len(t.cells) {
return t
}
t.cells = append(t.cells[:row], t.cells[row+1:]...)
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"RemoveRow",
"(",
"row",
"int",
")",
"*",
"Table",
"{",
"if",
"row",
"<",
"0",
"||",
"row",
">=",
"len",
"(",
"t",
".",
"cells",
")",
"{",
"return",
"t",
"\n",
"}",
"\n\n",
"t",
".",
"cells",
"=",
"append"... | // RemoveRow removes the row at the given position from the table. If there is
// no such row, this has no effect. | [
"RemoveRow",
"removes",
"the",
"row",
"at",
"the",
"given",
"position",
"from",
"the",
"table",
".",
"If",
"there",
"is",
"no",
"such",
"row",
"this",
"has",
"no",
"effect",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L455-L463 |
163,899 | rivo/tview | table.go | RemoveColumn | func (t *Table) RemoveColumn(column int) *Table {
for row := range t.cells {
if column < 0 || column >= len(t.cells[row]) {
continue
}
t.cells[row] = append(t.cells[row][:column], t.cells[row][column+1:]...)
}
return t
} | go | func (t *Table) RemoveColumn(column int) *Table {
for row := range t.cells {
if column < 0 || column >= len(t.cells[row]) {
continue
}
t.cells[row] = append(t.cells[row][:column], t.cells[row][column+1:]...)
}
return t
} | [
"func",
"(",
"t",
"*",
"Table",
")",
"RemoveColumn",
"(",
"column",
"int",
")",
"*",
"Table",
"{",
"for",
"row",
":=",
"range",
"t",
".",
"cells",
"{",
"if",
"column",
"<",
"0",
"||",
"column",
">=",
"len",
"(",
"t",
".",
"cells",
"[",
"row",
"... | // RemoveColumn removes the column at the given position from the table. If
// there is no such column, this has no effect. | [
"RemoveColumn",
"removes",
"the",
"column",
"at",
"the",
"given",
"position",
"from",
"the",
"table",
".",
"If",
"there",
"is",
"no",
"such",
"column",
"this",
"has",
"no",
"effect",
"."
] | 90b4da1bd64ceee13d2e7d782b315b819190f7bf | https://github.com/rivo/tview/blob/90b4da1bd64ceee13d2e7d782b315b819190f7bf/table.go#L467-L476 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.