MCPcopy
hub / github.com/ayn2op/discordo / rebuild

Method rebuild

internal/ui/chat/mentions_list.go:54–77  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52}
53
54func (m *mentionsList) rebuild() {
55 m.SetBuilder(func(index int) list.Item {
56 if index < 0 || index >= len(m.items) {
57 return nil
58 }
59
60 item := m.items[index]
61 style := item.style
62 line := tview.NewLine(tview.NewSegment(item.displayText, style))
63
64 return tview.NewTextView().
65 SetScrollable(false).
66 SetWrap(false).
67 SetWordWrap(false).
68 SetTextStyle(style).
69 SetLines([]tview.Line{line})
70 })
71
72 if len(m.items) == 0 {
73 m.SetCursor(-1)
74 return
75 }
76 m.SetCursor(0)
77}
78
79func (m *mentionsList) itemCount() int {
80 return len(m.items)

Callers 1

tabSuggestMethod · 0.80

Calls 1

SetCursorMethod · 0.80

Tested by

no test coverage detected