Merge branch 'hashtagcornyphrase' into 'master'

Don't replace tags when dealing with console input

See merge request OpenMW/openmw!3291
macos_ci_fix
psi29a 1 year ago
commit 84e71f4977

@ -285,7 +285,7 @@ namespace MWGui
{ {
if (key == MyGUI::KeyCode::W) if (key == MyGUI::KeyCode::W)
{ {
const auto& caption = mCommandLine->getCaption(); auto caption = mCommandLine->getOnlyText();
if (caption.empty()) if (caption.empty())
return; return;
size_t max = mCommandLine->getTextCursor(); size_t max = mCommandLine->getTextCursor();
@ -296,9 +296,8 @@ namespace MWGui
size_t length = mCommandLine->getTextCursor() - max; size_t length = mCommandLine->getTextCursor() - max;
if (length > 0) if (length > 0)
{ {
auto text = caption; caption.erase(max, length);
text.erase(max, length); mCommandLine->setOnlyText(caption);
mCommandLine->setCaption(text);
mCommandLine->setTextCursor(max); mCommandLine->setTextCursor(max);
} }
} }
@ -306,9 +305,9 @@ namespace MWGui
{ {
if (mCommandLine->getTextCursor() > 0) if (mCommandLine->getTextCursor() > 0)
{ {
auto text = mCommandLine->getCaption(); auto text = mCommandLine->getOnlyText();
text.erase(0, mCommandLine->getTextCursor()); text.erase(0, mCommandLine->getTextCursor());
mCommandLine->setCaption(text); mCommandLine->setOnlyText(text);
mCommandLine->setTextCursor(0); mCommandLine->setTextCursor(0);
} }
} }
@ -317,9 +316,9 @@ namespace MWGui
{ {
std::vector<std::string> matches; std::vector<std::string> matches;
listNames(); listNames();
std::string oldCaption = mCommandLine->getCaption(); std::string oldCaption = mCommandLine->getOnlyText();
std::string newCaption = complete(mCommandLine->getOnlyText(), matches); std::string newCaption = complete(mCommandLine->getOnlyText(), matches);
mCommandLine->setCaption(newCaption); mCommandLine->setOnlyText(newCaption);
// List candidates if repeatedly pressing tab // List candidates if repeatedly pressing tab
if (oldCaption == newCaption && !matches.empty()) if (oldCaption == newCaption && !matches.empty())
@ -350,7 +349,7 @@ namespace MWGui
if (mCurrent != mCommandHistory.begin()) if (mCurrent != mCommandHistory.begin())
{ {
--mCurrent; --mCurrent;
mCommandLine->setCaption(*mCurrent); mCommandLine->setOnlyText(*mCurrent);
} }
} }
else if (key == MyGUI::KeyCode::ArrowDown) else if (key == MyGUI::KeyCode::ArrowDown)
@ -360,10 +359,10 @@ namespace MWGui
++mCurrent; ++mCurrent;
if (mCurrent != mCommandHistory.end()) if (mCurrent != mCommandHistory.end())
mCommandLine->setCaption(*mCurrent); mCommandLine->setOnlyText(*mCurrent);
else else
// Restore the edit string // Restore the edit string
mCommandLine->setCaption(mEditString); mCommandLine->setOnlyText(mEditString);
} }
} }
} }

Loading…
Cancel
Save