Always set cursor to end when switching edit message

This commit is contained in:
Tulir Asokan 2020-02-19 23:48:47 +02:00
parent 55f58f2875
commit b6e20af056

View File

@ -380,6 +380,7 @@ func (view *RoomView) SetEditing(evt *event.Event) {
view.input.SetText(text) view.input.SetText(text)
} }
view.status.SetText(view.GetStatus()) view.status.SetText(view.GetStatus())
view.input.SetCursorOffset(-1)
} }
func (view *RoomView) findMessageToEdit(forward bool) *event.Event { func (view *RoomView) findMessageToEdit(forward bool) *event.Event {
@ -409,14 +410,12 @@ func (view *RoomView) EditNext() {
} }
foundEvent := view.findMessageToEdit(true) foundEvent := view.findMessageToEdit(true)
view.SetEditing(foundEvent) view.SetEditing(foundEvent)
view.input.SetCursorOffset(-1)
} }
func (view *RoomView) EditPrevious() { func (view *RoomView) EditPrevious() {
foundEvent := view.findMessageToEdit(false) foundEvent := view.findMessageToEdit(false)
if foundEvent != nil { if foundEvent != nil {
view.SetEditing(foundEvent) view.SetEditing(foundEvent)
view.input.SetCursorOffset(0)
} }
} }