Merge branch 'master' into update
This commit is contained in:
		@@ -21,6 +21,7 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"math"
 | 
			
		||||
 | 
			
		||||
	"maunium.net/go/gomuks/debug"
 | 
			
		||||
	"maunium.net/go/gomuks/matrix/rooms"
 | 
			
		||||
	"maunium.net/go/tcell"
 | 
			
		||||
@@ -313,6 +314,27 @@ func (list *RoomList) Next() (string, *rooms.Room) {
 | 
			
		||||
	return list.Last()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// NextWithActivity Returns next room with activity.
 | 
			
		||||
//
 | 
			
		||||
// Sorted by (in priority):
 | 
			
		||||
//
 | 
			
		||||
// - Highlights
 | 
			
		||||
// - Messages
 | 
			
		||||
// - Other traffic (joins, parts, etc)
 | 
			
		||||
//
 | 
			
		||||
// TODO: Sorting. Now just finds first room with new messages.
 | 
			
		||||
func (list *RoomList) NextWithActivity() (string, *rooms.Room) {
 | 
			
		||||
	for tag, trl := range list.items {
 | 
			
		||||
		for _, room := range trl.All() {
 | 
			
		||||
			if room.HasNewMessages() {
 | 
			
		||||
				return tag, room.Room
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	// No room with activity found
 | 
			
		||||
	return "", nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (list *RoomList) index(tag string, room *rooms.Room) int {
 | 
			
		||||
	tagIndex := list.IndexTag(tag)
 | 
			
		||||
	if tagIndex == -1 {
 | 
			
		||||
 
 | 
			
		||||
@@ -18,12 +18,13 @@ package ui
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"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 {
 | 
			
		||||
 
 | 
			
		||||
@@ -196,6 +196,8 @@ func (view *MainView) KeyEventHandler(roomView *RoomView, key *tcell.EventKey) *
 | 
			
		||||
			searchModal := NewFuzzySearchModal(view, 42, 12)
 | 
			
		||||
			view.parent.views.AddPage("fuzzy-search-modal", searchModal, true, true)
 | 
			
		||||
			view.parent.app.SetFocus(searchModal)
 | 
			
		||||
		case c == 'a':
 | 
			
		||||
			view.SwitchRoom(view.roomList.NextWithActivity())
 | 
			
		||||
		case c == 'l':
 | 
			
		||||
			view.ShowBare(roomView)
 | 
			
		||||
		default:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user