@@ 27,7 27,7 @@ func TUI(client *mautrix.Client, elections *election.ElectionsMap) (el *election
}
list := tview.NewList()
list.SetTitle("Select a room").SetBorder(true)
- for i, roomID := range resp.JoinedRooms {
+ for _, roomID := range resp.JoinedRooms {
name := string(roomID)
room := client.Store.LoadRoom(roomID)
if room != nil {
@@ 35,7 35,7 @@ func TUI(client *mautrix.Client, elections *election.ElectionsMap) (el *election
name = roomNameEvent.Content.AsRoomName().Name
}
}
- list.AddItem(name, string(roomID), rune('a'+i), nil)
+ list.AddItem(name, string(roomID), 0, nil)
}
update := func() {
for i, roomID := range resp.JoinedRooms {
@@ 70,7 70,7 @@ func RoomTUI(client *mautrix.Client, roomID id.RoomID, elections *election.Elect
alive := true
app := tview.NewApplication()
list := tview.NewList().
- AddItem("Create Election", "start a new election in this room", '+', nil)
+ AddItem("Create Election", "start a new election in this room", 0, nil)
list.SetTitle("Select election").SetBorder(true)
var L []*election.Election
var Ltime time.Time = elections.Ltime.Add(-1 * time.Millisecond)
@@ 83,14 83,13 @@ func RoomTUI(client *mautrix.Client, roomID id.RoomID, elections *election.Elect
L = elections.L[roomID]
Ltime = elections.Ltime
list.Clear()
- list.AddItem("Create Election", "start a new election in this room", '+', nil)
- for i, el := range L {
+ list.AddItem("Create Election", "start a new election in this room", 0, nil)
+ for _, el := range L {
title := el.Title
if title == "" {
title = "<no name>"
}
- list.AddItem(title, fmt.Sprintf("created by %s, ID: %s", el.Creator, el.CreateEventId), rune('a'+i), nil)
- i++
+ list.AddItem(title, fmt.Sprintf("created by %s, ID: %s", el.Creator, el.CreateEventId), 0, nil)
}
}
go func() {