From 34359a0599269ba8e1bf535b8dd8cfda0d72e687 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 22 May 2018 18:43:00 +0300 Subject: [PATCH] More cleanup --- ui/room-list.go | 10 +++++----- ui/tag-room-list.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ui/room-list.go b/ui/room-list.go index 9588a55..e5b4d4e 100644 --- a/ui/room-list.go +++ b/ui/room-list.go @@ -330,7 +330,7 @@ func (list *RoomList) index(tag string, room *rooms.Room) int { localIndex = trl.Length() - 1 - localIndex // Tag header - localIndex += 1 + localIndex++ if tagIndex > 0 { 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] if line--; line == -1 { trl.ToggleCollapse() - return "", nil + break } if trl.IsCollapsed() { @@ -367,7 +367,7 @@ func (list *RoomList) HandleClick(column, line int, mod bool) (string, *rooms.Ro } if line < 0 { - return "", nil + break } else if line < trl.Length() { 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 { trl.maxShown = 10 } - return "", nil + break } } // Tag footer @@ -439,7 +439,7 @@ func (list *RoomList) Draw(screen tcell.Screen) { } renderHeight := trl.RenderHeight() - if y + renderHeight >= yLimit { + if y+renderHeight >= yLimit { renderHeight = yLimit - y } trl.SetRect(x, y, width, renderHeight) diff --git a/ui/tag-room-list.go b/ui/tag-room-list.go index d342d59..dffe3c2 100644 --- a/ui/tag-room-list.go +++ b/ui/tag-room-list.go @@ -17,13 +17,13 @@ package ui import ( - "maunium.net/go/gomuks/matrix/rooms" - "strings" "fmt" - "maunium.net/go/tcell" - "strconv" + "maunium.net/go/gomuks/matrix/rooms" "maunium.net/go/gomuks/ui/widget" + "maunium.net/go/tcell" "maunium.net/go/tview" + "strconv" + "strings" ) type OrderedRoom struct {