mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-19 05:24:48 -04:00
fix(tracker): unit search gains focus when adding a unit on last row
This commit is contained in:
parent
877556b428
commit
6fc9277113
@ -299,11 +299,15 @@ func (m *Units) SelectedType() string {
|
||||
|
||||
func (m *Units) SetSelectedType(t string) {
|
||||
if m.d.InstrIndex < 0 ||
|
||||
m.d.InstrIndex >= len(m.d.Song.Patch) ||
|
||||
m.d.UnitIndex < 0 ||
|
||||
m.d.UnitIndex >= len(m.d.Song.Patch[m.d.InstrIndex].Units) {
|
||||
m.d.InstrIndex >= len(m.d.Song.Patch) {
|
||||
return
|
||||
}
|
||||
if m.d.UnitIndex < 0 {
|
||||
m.d.UnitIndex = 0
|
||||
}
|
||||
for len(m.d.Song.Patch[m.d.InstrIndex].Units) <= m.d.UnitIndex {
|
||||
m.d.Song.Patch[m.d.InstrIndex].Units = append(m.d.Song.Patch[m.d.InstrIndex].Units, sointu.Unit{})
|
||||
}
|
||||
unit, ok := defaultUnits[t]
|
||||
if !ok { // if the type is invalid, we just set it to empty unit
|
||||
unit = sointu.Unit{Parameters: make(map[string]int)}
|
||||
|
Reference in New Issue
Block a user