RemoveItem removes an item at the given index. If the index is out of bounds this will be a no-op. O(n) complexity, which probably won't matter in the case of a TUI.
(index int)
| 341 | // this will be a no-op. O(n) complexity, which probably won't matter in the |
| 342 | // case of a TUI. |
| 343 | func (m *Model) RemoveItem(index int) { |
| 344 | m.items = removeItemFromSlice(m.items, index) |
| 345 | if m.filterState != Unfiltered { |
| 346 | m.filteredItems = removeFilterMatchFromSlice(m.filteredItems, index) |
| 347 | if len(m.filteredItems) == 0 { |
| 348 | m.resetFiltering() |
| 349 | } |
| 350 | } |
| 351 | m.updatePagination() |
| 352 | } |
| 353 | |
| 354 | // Set the item delegate. |
| 355 | func (m *Model) SetDelegate(d ItemDelegate) { |
no test coverage detected