Fixed an issue where the wrong help prompt was shown for the 'A' button when editing multi-line text fields.

This commit is contained in:
Leon Styhre 2022-12-20 21:54:49 +01:00
parent aa33558952
commit 3b9ced603c
2 changed files with 15 additions and 12 deletions

View file

@ -480,12 +480,15 @@ void GuiTextEditKeyboardPopup::update(int deltaTime)
std::vector<HelpPrompt> GuiTextEditKeyboardPopup::getHelpPrompts() std::vector<HelpPrompt> GuiTextEditKeyboardPopup::getHelpPrompts()
{ {
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts(); std::vector<HelpPrompt> prompts {mGrid.getHelpPrompts()};
if (!mText->isEditing()) { if (!mText->isEditing()) {
prompts.push_back(HelpPrompt("lt", "shift")); prompts.push_back(HelpPrompt("lt", "shift"));
prompts.push_back(HelpPrompt("rt", "alt")); prompts.push_back(HelpPrompt("rt", "alt"));
} }
else if (mMultiLine) {
prompts.push_back(HelpPrompt("a", "newline"));
}
else { else {
prompts.push_back(HelpPrompt("a", mAcceptBtnHelpText)); prompts.push_back(HelpPrompt("a", mAcceptBtnHelpText));
} }
@ -496,17 +499,13 @@ std::vector<HelpPrompt> GuiTextEditKeyboardPopup::getHelpPrompts()
if (prompts.size() > 0 && prompts.front().second == OK_SYMBOL) if (prompts.size() > 0 && prompts.front().second == OK_SYMBOL)
prompts.front().second = mAcceptBtnHelpText; prompts.front().second = mAcceptBtnHelpText;
else if (prompts.size() > 0 && prompts.front().second == " ")
if (prompts.size() > 0 && prompts.front().second == " ")
prompts.front().second = "SPACE"; prompts.front().second = "SPACE";
else if (prompts.size() > 0 && prompts.front().second == "CLEAR")
if (prompts.size() > 0 && prompts.front().second == "CLEAR")
prompts.front().second = mClearBtnHelpText; prompts.front().second = mClearBtnHelpText;
else if (prompts.size() > 0 && prompts.front().second == "LOAD")
if (prompts.size() > 0 && prompts.front().second == "LOAD")
prompts.front().second = mLoadBtnHelpText; prompts.front().second = mLoadBtnHelpText;
else if (prompts.size() > 0 && prompts.front().second == "CANCEL")
if (prompts.size() > 0 && prompts.front().second == "CANCEL")
prompts.front().second = mCancelBtnHelpText; prompts.front().second = mCancelBtnHelpText;
// If a prompt has no value set, then remove it. // If a prompt has no value set, then remove it.

View file

@ -251,10 +251,14 @@ void GuiTextEditPopup::update(int deltaTime)
std::vector<HelpPrompt> GuiTextEditPopup::getHelpPrompts() std::vector<HelpPrompt> GuiTextEditPopup::getHelpPrompts()
{ {
std::vector<HelpPrompt> prompts = mGrid.getHelpPrompts(); std::vector<HelpPrompt> prompts {mGrid.getHelpPrompts()};
if (mText->isEditing()) if (mText->isEditing()) {
prompts.push_back(HelpPrompt("a", mAcceptBtnText)); if (mMultiLine)
prompts.push_back(HelpPrompt("a", "newline"));
else
prompts.push_back(HelpPrompt("a", mAcceptBtnText));
}
prompts.push_back(HelpPrompt("l", "backspace")); prompts.push_back(HelpPrompt("l", "backspace"));
prompts.push_back(HelpPrompt("r", "space")); prompts.push_back(HelpPrompt("r", "space"));