From 3b9ced603c4315c399acb31801d4e09b62838783 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 20 Dec 2022 21:54:49 +0100 Subject: [PATCH] Fixed an issue where the wrong help prompt was shown for the 'A' button when editing multi-line text fields. --- es-core/src/guis/GuiTextEditKeyboardPopup.cpp | 17 ++++++++--------- es-core/src/guis/GuiTextEditPopup.cpp | 10 +++++++--- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/es-core/src/guis/GuiTextEditKeyboardPopup.cpp b/es-core/src/guis/GuiTextEditKeyboardPopup.cpp index cb7f7cc41..77c16aefb 100644 --- a/es-core/src/guis/GuiTextEditKeyboardPopup.cpp +++ b/es-core/src/guis/GuiTextEditKeyboardPopup.cpp @@ -480,12 +480,15 @@ void GuiTextEditKeyboardPopup::update(int deltaTime) std::vector GuiTextEditKeyboardPopup::getHelpPrompts() { - std::vector prompts = mGrid.getHelpPrompts(); + std::vector prompts {mGrid.getHelpPrompts()}; if (!mText->isEditing()) { prompts.push_back(HelpPrompt("lt", "shift")); prompts.push_back(HelpPrompt("rt", "alt")); } + else if (mMultiLine) { + prompts.push_back(HelpPrompt("a", "newline")); + } else { prompts.push_back(HelpPrompt("a", mAcceptBtnHelpText)); } @@ -496,17 +499,13 @@ std::vector GuiTextEditKeyboardPopup::getHelpPrompts() if (prompts.size() > 0 && prompts.front().second == OK_SYMBOL) prompts.front().second = mAcceptBtnHelpText; - - if (prompts.size() > 0 && prompts.front().second == " ") + else if (prompts.size() > 0 && prompts.front().second == " ") prompts.front().second = "SPACE"; - - if (prompts.size() > 0 && prompts.front().second == "CLEAR") + else if (prompts.size() > 0 && prompts.front().second == "CLEAR") prompts.front().second = mClearBtnHelpText; - - if (prompts.size() > 0 && prompts.front().second == "LOAD") + else if (prompts.size() > 0 && prompts.front().second == "LOAD") prompts.front().second = mLoadBtnHelpText; - - if (prompts.size() > 0 && prompts.front().second == "CANCEL") + else if (prompts.size() > 0 && prompts.front().second == "CANCEL") prompts.front().second = mCancelBtnHelpText; // If a prompt has no value set, then remove it. diff --git a/es-core/src/guis/GuiTextEditPopup.cpp b/es-core/src/guis/GuiTextEditPopup.cpp index 6a3a59492..761c36d87 100644 --- a/es-core/src/guis/GuiTextEditPopup.cpp +++ b/es-core/src/guis/GuiTextEditPopup.cpp @@ -251,10 +251,14 @@ void GuiTextEditPopup::update(int deltaTime) std::vector GuiTextEditPopup::getHelpPrompts() { - std::vector prompts = mGrid.getHelpPrompts(); + std::vector prompts {mGrid.getHelpPrompts()}; - if (mText->isEditing()) - prompts.push_back(HelpPrompt("a", mAcceptBtnText)); + if (mText->isEditing()) { + 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("r", "space"));