Skip to content

Commit

Permalink
Fix editing same message many times. Fixes #195
Browse files Browse the repository at this point in the history
  • Loading branch information
tulir committed Aug 30, 2020
1 parent d9407ee commit db4aa77
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ui/room-view.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,13 @@ func (view *RoomView) SetEditing(evt *muksevt.Event) {
view.editing = evt
// replying should never be non-nil when SetEditing, but do this just to be safe
view.replying = nil
text := view.editing.Content.AsMessage().Body
if view.editing.Content.AsMessage().MsgType == event.MsgEmote {
msgContent := view.editing.Content.AsMessage()
if len(view.editing.Gomuks.Edits) > 0 {
// This feels kind of dangerous, but I think it works
msgContent = view.editing.Gomuks.Edits[len(view.editing.Gomuks.Edits)-1].Content.AsMessage().NewContent
}
text := msgContent.Body
if msgContent.MsgType == event.MsgEmote {
text = "/me " + text
}
view.input.SetText(text)
Expand Down

0 comments on commit db4aa77

Please sign in to comment.