More cleanup

This commit is contained in:
Tulir Asokan 2018-05-22 18:43:00 +03:00
parent dc4e831022
commit 34359a0599
2 changed files with 9 additions and 9 deletions

View File

@ -330,7 +330,7 @@ func (list *RoomList) index(tag string, room *rooms.Room) int {
localIndex = trl.Length() - 1 - localIndex localIndex = trl.Length() - 1 - localIndex
// Tag header // Tag header
localIndex += 1 localIndex++
if tagIndex > 0 { if tagIndex > 0 {
for i := 0; i < tagIndex; i++ { for i := 0; i < tagIndex; i++ {
@ -359,7 +359,7 @@ func (list *RoomList) HandleClick(column, line int, mod bool) (string, *rooms.Ro
trl := list.items[tag] trl := list.items[tag]
if line--; line == -1 { if line--; line == -1 {
trl.ToggleCollapse() trl.ToggleCollapse()
return "", nil break
} }
if trl.IsCollapsed() { if trl.IsCollapsed() {
@ -367,7 +367,7 @@ func (list *RoomList) HandleClick(column, line int, mod bool) (string, *rooms.Ro
} }
if line < 0 { if line < 0 {
return "", nil break
} else if line < trl.Length() { } else if line < trl.Length() {
return tag, trl.Visible()[trl.Length()-1-line].Room return tag, trl.Visible()[trl.Length()-1-line].Room
} }
@ -392,7 +392,7 @@ func (list *RoomList) HandleClick(column, line int, mod bool) (string, *rooms.Ro
if trl.maxShown < 10 { if trl.maxShown < 10 {
trl.maxShown = 10 trl.maxShown = 10
} }
return "", nil break
} }
} }
// Tag footer // Tag footer
@ -439,7 +439,7 @@ func (list *RoomList) Draw(screen tcell.Screen) {
} }
renderHeight := trl.RenderHeight() renderHeight := trl.RenderHeight()
if y + renderHeight >= yLimit { if y+renderHeight >= yLimit {
renderHeight = yLimit - y renderHeight = yLimit - y
} }
trl.SetRect(x, y, width, renderHeight) trl.SetRect(x, y, width, renderHeight)

View File

@ -17,13 +17,13 @@
package ui package ui
import ( import (
"maunium.net/go/gomuks/matrix/rooms"
"strings"
"fmt" "fmt"
"maunium.net/go/tcell" "maunium.net/go/gomuks/matrix/rooms"
"strconv"
"maunium.net/go/gomuks/ui/widget" "maunium.net/go/gomuks/ui/widget"
"maunium.net/go/tcell"
"maunium.net/go/tview" "maunium.net/go/tview"
"strconv"
"strings"
) )
type OrderedRoom struct { type OrderedRoom struct {