aboutsummaryrefslogtreecommitdiff
path: root/vendor/maunium.net/go/tview/list.go
diff options
context:
space:
mode:
authorTulir Asokan <tulir@maunium.net>2018-11-14 00:00:35 +0200
committerTulir Asokan <tulir@maunium.net>2018-11-14 00:00:35 +0200
commitba387764ca1590625d349e74eb8a8a64d1849b67 (patch)
treebc8f02156a63eac99dcddaed38e45b7c312b40c0 /vendor/maunium.net/go/tview/list.go
parentcfb2cc057c32330be0ca0a68cfbd245cb2b8e31b (diff)
Fix things
Diffstat (limited to 'vendor/maunium.net/go/tview/list.go')
-rw-r--r--vendor/maunium.net/go/tview/list.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/vendor/maunium.net/go/tview/list.go b/vendor/maunium.net/go/tview/list.go
index bc5be85..e8dc5dd 100644
--- a/vendor/maunium.net/go/tview/list.go
+++ b/vendor/maunium.net/go/tview/list.go
@@ -85,6 +85,19 @@ func (l *List) GetCurrentItem() int {
return l.currentItem
}
+// RemoveItem removes the item with the given index (starting at 0) from the
+// list. Does nothing if the index is out of range.
+func (l *List) RemoveItem(index int) *List {
+ if index < 0 || index >= len(l.items) {
+ return l
+ }
+ l.items = append(l.items[:index], l.items[index+1:]...)
+ if l.currentItem >= len(l.items) {
+ l.currentItem = len(l.items) - 1
+ }
+ return l
+}
+
// SetMainTextColor sets the color of the items' main text.
func (l *List) SetMainTextColor(color tcell.Color) *List {
l.mainTextColor = color
@@ -127,7 +140,7 @@ func (l *List) ShowSecondaryText(show bool) *List {
//
// This function is also called when the first item is added or when
// SetCurrentItem() is called.
-func (l *List) SetChangedFunc(handler func(int, string, string, rune)) *List {
+func (l *List) SetChangedFunc(handler func(index int, mainText string, secondaryText string, shortcut rune)) *List {
l.changed = handler
return l
}