MCPcopy
hub / github.com/mathaou/termdbms / RemoveItem

Method RemoveItem

list/list.go:343–352  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

341// this will be a no-op. O(n) complexity, which probably won't matter in the
342// case of a TUI.
343func (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.
355func (m *Model) SetDelegate(d ItemDelegate) {

Callers 1

handleBrowsingMethod · 0.95

Calls 4

resetFilteringMethod · 0.95
updatePaginationMethod · 0.95
removeItemFromSliceFunction · 0.85

Tested by

no test coverage detected