fix(tracker): adding order row moved cursor incorrectly

This commit is contained in:
5684185+vsariola@users.noreply.github.com 2024-10-19 00:00:29 +03:00
parent 1c42a51cc6
commit 025f8832d9
2 changed files with 2 additions and 6 deletions

View File

@ -336,7 +336,7 @@ func (m *Model) StopPlaying() Action {
func (m *Model) AddOrderRow(before bool) Action {
return Allow(func() {
defer m.change("AddOrderRowAction", ScoreChange, MinorChange)()
if before {
if !before {
m.d.Cursor.OrderRow++
}
m.d.Cursor2.OrderRow = m.d.Cursor.OrderRow

View File

@ -186,11 +186,7 @@ func (oe *OrderEditor) command(t *Tracker, e key.Event) {
t.Model.DeleteOrderRow(false).Do()
}
case key.NameReturn:
if e.Modifiers.Contain(key.ModShortcut) {
oe.scrollTable.Table.MoveCursor(0, -1)
oe.scrollTable.Table.SetCursor2(oe.scrollTable.Table.Cursor())
}
t.Model.AddOrderRow(!e.Modifiers.Contain(key.ModShortcut)).Do()
t.Model.AddOrderRow(e.Modifiers.Contain(key.ModShortcut)).Do()
}
if iv, err := strconv.Atoi(string(e.Name)); err == nil {
t.Model.Order().SetValue(oe.scrollTable.Table.Cursor(), iv)