From c47489ef6e20513ff3be66301bee7810a85cac6b Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Sat, 29 Jul 2023 17:07:37 +0200 Subject: [PATCH] Don't replace tags when dealing with console input --- apps/openmw/mwgui/console.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 4ef454df7b..e781d78afe 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -277,7 +277,7 @@ namespace MWGui { if (key == MyGUI::KeyCode::W) { - const auto& caption = mCommandLine->getCaption(); + auto caption = mCommandLine->getOnlyText(); if (caption.empty()) return; size_t max = mCommandLine->getTextCursor(); @@ -288,9 +288,8 @@ namespace MWGui size_t length = mCommandLine->getTextCursor() - max; if (length > 0) { - auto text = caption; - text.erase(max, length); - mCommandLine->setCaption(text); + caption.erase(max, length); + mCommandLine->setOnlyText(caption); mCommandLine->setTextCursor(max); } } @@ -298,9 +297,9 @@ namespace MWGui { if (mCommandLine->getTextCursor() > 0) { - auto text = mCommandLine->getCaption(); + auto text = mCommandLine->getOnlyText(); text.erase(0, mCommandLine->getTextCursor()); - mCommandLine->setCaption(text); + mCommandLine->setOnlyText(text); mCommandLine->setTextCursor(0); } } @@ -309,9 +308,9 @@ namespace MWGui { std::vector matches; listNames(); - std::string oldCaption = mCommandLine->getCaption(); + std::string oldCaption = mCommandLine->getOnlyText(); std::string newCaption = complete(mCommandLine->getOnlyText(), matches); - mCommandLine->setCaption(newCaption); + mCommandLine->setOnlyText(newCaption); // List candidates if repeatedly pressing tab if (oldCaption == newCaption && !matches.empty()) @@ -342,7 +341,7 @@ namespace MWGui if (mCurrent != mCommandHistory.begin()) { --mCurrent; - mCommandLine->setCaption(*mCurrent); + mCommandLine->setOnlyText(*mCurrent); } } else if (key == MyGUI::KeyCode::ArrowDown) @@ -352,10 +351,10 @@ namespace MWGui ++mCurrent; if (mCurrent != mCommandHistory.end()) - mCommandLine->setCaption(*mCurrent); + mCommandLine->setOnlyText(*mCurrent); else // Restore the edit string - mCommandLine->setCaption(mEditString); + mCommandLine->setOnlyText(mEditString); } } }