aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
Diffstat (limited to 'ui')
-rw-r--r--ui/room-view.go16
1 files changed, 12 insertions, 4 deletions
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 {