chore: remove unused methods

Kujtim Hoxha created

Change summary

internal/ui/chat/chat.go       | 18 ------------------
internal/ui/list/filterable.go | 10 ----------
internal/ui/list/list.go       | 31 -------------------------------
3 files changed, 59 deletions(-)

Detailed changes

internal/ui/chat/chat.go 🔗

@@ -77,12 +77,6 @@ func (m *Chat) Len() int {
 	return m.list.Len()
 }
 
-// PrependItems prepends new items to the chat list.
-func (m *Chat) PrependItems(items ...list.Item) {
-	m.list.PrependItems(items...)
-	m.list.ScrollToIndex(0)
-}
-
 // SetMessages sets the chat messages to the provided list of message items.
 func (m *Chat) SetMessages(msgs ...MessageItem) {
 	items := make([]list.Item, len(msgs))
@@ -108,18 +102,6 @@ func (m *Chat) AppendItems(items ...list.Item) {
 	m.list.ScrollToIndex(m.list.Len() - 1)
 }
 
-// UpdateMessage updates an existing message by ID. Returns true if the message
-// was found and updated.
-func (m *Chat) UpdateMessage(id string, msg MessageItem) bool {
-	for i := 0; i < m.list.Len(); i++ {
-		item := m.list.GetItemAt(i)
-		if identifiable, ok := item.(Identifiable); ok && identifiable.ID() == id {
-			return m.list.UpdateItemAt(i, msg)
-		}
-	}
-	return false
-}
-
 // GetMessage returns the message with the given ID. Returns nil if not found.
 func (m *Chat) GetMessage(id string) MessageItem {
 	for i := 0; i < m.list.Len(); i++ {

internal/ui/list/filterable.go 🔗

@@ -55,16 +55,6 @@ func (f *FilterableList) AppendItems(items ...FilterableItem) {
 	f.List.SetItems(itms...)
 }
 
-// PrependItems prepends items to the list and updates the filtered items.
-func (f *FilterableList) PrependItems(items ...FilterableItem) {
-	f.items = append(items, f.items...)
-	itms := make([]Item, len(f.items))
-	for i, item := range f.items {
-		itms[i] = item
-	}
-	f.List.SetItems(itms...)
-}
-
 // SetFilter sets the filter query and updates the list items.
 func (f *FilterableList) SetFilter(q string) {
 	f.query = q

internal/ui/list/list.go 🔗

@@ -375,26 +375,6 @@ func (l *List) Render() string {
 	return strings.Join(lines, "\n")
 }
 
-// PrependItems prepends items to the list.
-func (l *List) PrependItems(items ...Item) {
-	l.items = append(items, l.items...)
-
-	// Shift cache
-	newCache := make(map[int]renderedItem)
-	for idx, val := range l.renderedItems {
-		newCache[idx+len(items)] = val
-	}
-	l.renderedItems = newCache
-
-	// Keep view position relative to the content that was visible
-	l.offsetIdx += len(items)
-
-	// Update selection index if valid
-	if l.selectedIdx != -1 {
-		l.selectedIdx += len(items)
-	}
-}
-
 // SetItems sets the items in the list.
 func (l *List) SetItems(items ...Item) {
 	l.setItems(true, items...)
@@ -417,17 +397,6 @@ func (l *List) AppendItems(items ...Item) {
 	l.items = append(l.items, items...)
 }
 
-// UpdateItemAt updates the item at the given index and invalidates its cache.
-// Returns true if the index was valid and the item was updated.
-func (l *List) UpdateItemAt(idx int, item Item) bool {
-	if idx < 0 || idx >= len(l.items) {
-		return false
-	}
-	l.items[idx] = item
-	l.invalidateItem(idx)
-	return true
-}
-
 // GetItemAt returns the item at the given index. Returns nil if the index is
 // out of bounds.
 func (l *List) GetItemAt(idx int) Item {