command palette: improve checks on item selection

This commit is contained in:
YohananDiamond 2023-07-01 15:15:41 -03:00
parent 869e5d7be9
commit 55d791f852

View file

@ -121,10 +121,7 @@ void FurnaceGUI::drawPalette() {
if (curPaletteChoice>=(int)paletteSearchResults.size()) {
curPaletteChoice=paletteSearchResults.size()-1;
}
if (ImGui::IsKeyPressed(ImGuiKey_Enter)) {
// TODO: properly test this - what happens when enter is pressed and the list is empty?
accepted=true;
}
accepted=ImGui::IsKeyPressed(ImGuiKey_Enter);
}
if (ImGui::Button("Cancel") || ImGui::IsKeyPressed(ImGuiKey_Escape)) {
@ -132,8 +129,10 @@ void FurnaceGUI::drawPalette() {
}
if (accepted) {
if (paletteSearchResults.size()==0) {
ImGui::CloseCurrentPopup();
} else {
int i=paletteSearchResults[curPaletteChoice];
switch (curPaletteType) {
case CMDPAL_TYPE_MAIN:
resetPalette(this);
@ -153,7 +152,8 @@ void FurnaceGUI::drawPalette() {
// TODO: PANIC! DIE! PERISH!
break;
};
} else {
}
}
paletteFirstFrame=false;
}
}