From 679020395864c10e22eca480711f531c6583dbbb Mon Sep 17 00:00:00 2001 From: depate Date: Thu, 11 Oct 2018 19:14:24 +0200 Subject: [PATCH 1/3] Commands are invoked with a leading slash (like in Wiki). This patch makes that clear on the landing page --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 79509d3..829fa04 100644 --- a/README.md +++ b/README.md @@ -32,13 +32,13 @@ or compile from source: - jump to room - `Alt + Enter`, then `Tab` and `Enter` to navigate and select room ### Commands -* `help` - Is a known command -* `me ` - Send an emote -* `quit` - Close gomuks -* `clearcache` - Clear room state and close gomuks -* `leave` - Leave the current room -* `join ` - Join the room with the given room ID or alias -* `toggle ` - Change user preferences -* `logout` - Log out, clear caches and go back to the login view -* `send ` - Send a custom event -* `setstate ` - Change room state +* `/help` - Is a known command +* `/me ` - Send an emote +* `/quit` - Close gomuks +* `/clearcache` - Clear room state and close gomuks +* `/leave` - Leave the current room +* `/join ` - Join the room with the given room ID or alias +* `/toggle ` - Change user preferences +* `/logout` - Log out, clear caches and go back to the login view +* `/send ` - Send a custom event +* `/setstate ` - Change room state From e0e2b4f2f14bea1453ff54de12eecec4c7d70f04 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 18 Oct 2018 15:55:17 +0300 Subject: [PATCH 2/3] Add basic development instructions --- README.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 829fa04..ccabc5a 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,20 @@ or compile from source: 1. Run `go get -u maunium.net/go/gomuks` 2. gomuks should now be in `$GOPATH/bin/gomuks` +## Developing +Running `go install` in `$GOPATH/src/maunium.net/go/gomuks` will recompile the project and dependencies into `$GOPATH/bin/gomuks`. + +For debugging, use `tail -f /tmp/gomuks-debug.log` and write to it using the methods in the `maunium.net/go/gomuks/debug` package: +```go +import ( + "maunium.net/go/gomuks/debug" +) +... +func Foo() { + debug.Print("WHY ISN'T IT WORKING?!?!?") +} +``` + ## Usage - switch rooms - `Ctrl + ↑` `Ctrl + ↓` `Alt + ↑` `Alt + ↓` - scroll chat (line) - `↑` `↓` @@ -41,4 +55,4 @@ or compile from source: * `/toggle ` - Change user preferences * `/logout` - Log out, clear caches and go back to the login view * `/send ` - Send a custom event -* `/setstate ` - Change room state +* `/setstate ` - Change room state From 7417df0f3ca20d6fcc0ef6ecb122dacf2afd741f Mon Sep 17 00:00:00 2001 From: Ville Ranki Date: Thu, 18 Oct 2018 17:02:38 +0300 Subject: [PATCH 3/3] Alt-a to jump to next channel with unread messages. --- ui/room-list.go | 22 ++++++++++++++++++++++ ui/tag-room-list.go | 5 +++-- ui/view-main.go | 2 ++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/ui/room-list.go b/ui/room-list.go index a7543a9..6b81e60 100644 --- a/ui/room-list.go +++ b/ui/room-list.go @@ -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 { diff --git a/ui/tag-room-list.go b/ui/tag-room-list.go index 2705c49..60b4350 100644 --- a/ui/tag-room-list.go +++ b/ui/tag-room-list.go @@ -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 { diff --git a/ui/view-main.go b/ui/view-main.go index f38043a..8bd0668 100644 --- a/ui/view-main.go +++ b/ui/view-main.go @@ -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: