Inputs: fix editing after insert/delete

As with mixers, the index used was that captured when executing createLineButton() rather than the real current index.
This commit is contained in:
Raphael Coeffic
2022-06-19 14:06:39 +02:00
parent f35fc68bfd
commit f612920841
+15 -13
View File
@@ -279,20 +279,22 @@ InputMixButton* ModelInputsPage::createLineButton(InputMixGroup *group,
uint8_t input = group->getMixSrc() - MIXSRC_FIRST_INPUT; uint8_t input = group->getMixSrc() - MIXSRC_FIRST_INPUT;
button->setPressHandler([=]() -> uint8_t { button->setPressHandler([=]() -> uint8_t {
Menu *menu = new Menu(form); Menu *menu = new Menu(form);
menu->addLine(STR_EDIT, [=]() { editInput(input, index); }); menu->addLine(STR_EDIT, [=]() {
uint8_t idx = button->getIndex();
editInput(input, idx);
_copyMode = 0;
});
if (!reachExposLimit()) { if (!reachExposLimit()) {
menu->addLine(STR_INSERT_BEFORE, menu->addLine(STR_INSERT_BEFORE, [=]() {
[=]() { uint8_t idx = button->getIndex();
uint8_t idx = button->getIndex(); insertInput(input, idx);
insertInput(input, idx); _copyMode = 0;
_copyMode = 0; });
}); menu->addLine(STR_INSERT_AFTER, [=]() {
menu->addLine(STR_INSERT_AFTER, uint8_t idx = button->getIndex();
[=]() { insertInput(input, idx + 1);
uint8_t idx = button->getIndex(); _copyMode = 0;
insertInput(input, idx + 1); });
_copyMode = 0;
});
menu->addLine(STR_COPY, [=]() { menu->addLine(STR_COPY, [=]() {
_copyMode = COPY_MODE; _copyMode = COPY_MODE;
_copySrc = button; _copySrc = button;