diff options
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | ui/room-view.go | 16 |
3 files changed, 15 insertions, 5 deletions
@@ -19,7 +19,7 @@ require ( golang.org/x/net v0.0.0-20200202094626-16171245cfb2 gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 gopkg.in/yaml.v2 v2.2.8 - maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229222711-57beb97fdccb + maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1 maunium.net/go/mauview v0.0.0-20200220222850-39f1414676d9 maunium.net/go/tcell v1.1.2-0.20200218183045-87c4a25c5b09 ) @@ -88,6 +88,8 @@ maunium.net/go/mautrix v0.1.0-alpha.3.0.20200221234248-8a868bce2854 h1:NKj52IqLk maunium.net/go/mautrix v0.1.0-alpha.3.0.20200221234248-8a868bce2854/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4= maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229222711-57beb97fdccb h1:b9cMiQ85HtNhV/gItnjdEFC7nQTWmvnALiHQiYqrJAU= maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229222711-57beb97fdccb/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4= +maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1 h1:2XQfQNWeNhhEXrb2HgOpTi26o7qq17lQCwSl6wDz2WM= +maunium.net/go/mautrix v0.1.0-alpha.3.0.20200229230354-be576ef8fcb1/go.mod h1:g10T1fh2Q2HkJWycVs93eBXdWpqD67f1YVQhNxdIDr4= maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176 h1:KoTm7ASEzFIZ1SvPWuWYzpkeA+wiR1fuUu4l7TCHcE0= maunium.net/go/mauview v0.0.0-20200218183549-88ecb1321176/go.mod h1:jwg3Ow7akzsCX3q38pZAfmEC5gGN8gXwMyyjy/yZVMg= maunium.net/go/mauview v0.0.0-20200218231215-04d01c601d5b h1:Bfov5IkJQpkqDexiFioHIZpx4XL7AILDA1GwLVdqtBw= diff --git a/ui/room-view.go b/ui/room-view.go index a54a5de..07aaef9 100644 --- a/ui/room-view.go +++ b/ui/room-view.go @@ -188,7 +188,7 @@ func (view *RoomView) GetStatus() string { buf.WriteString(view.replying.Sender) buf.WriteString(" - ") } else if view.selecting { - buf.WriteString("Selecting message to") + buf.WriteString("Selecting message to ") buf.WriteString(string(view.selectReason)) buf.WriteString(" - ") } @@ -280,9 +280,19 @@ func (view *RoomView) Draw(screen mauview.Screen) { } } +func (view *RoomView) ClearAllContext() { + view.MessageView().SetSelected(nil) + view.SetEditing(nil) + view.replying = nil + view.selecting = false + view.selectContent = "" +} + func (view *RoomView) OnKeyEvent(event mauview.KeyEvent) bool { msgView := view.MessageView() switch event.Key() { + case tcell.KeyEscape: + view.ClearAllContext() case tcell.KeyPgUp: if msgView.IsAtTop() { go view.parent.LoadHistory(view.Room.ID) @@ -510,7 +520,6 @@ func (view *RoomView) InputSubmit(text string) { } view.editMoveText = "" view.SetInputText("") - view.MessageView().SetSelected(nil) } func (view *RoomView) SendReaction(eventID string, reaction string) { @@ -562,8 +571,7 @@ func (view *RoomView) SendMessage(msgtype mautrix.MessageType, text string) { evt := view.parent.matrix.PrepareMarkdownMessage(view.Room.ID, msgtype, text, rel) msg := view.parseEvent(evt.SomewhatDangerousCopy()) view.content.AddMessage(msg, AppendMessage) - view.editing = nil - view.replying = nil + view.ClearAllContext() view.status.SetText(view.GetStatus()) eventID, err := view.parent.matrix.SendEvent(evt) if err != nil { |