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)
{
const auto& caption = mCommandLine->getCaption();
auto caption = mCommandLine->getOnlyText();
if (caption.empty())
return;
size_t max = mCommandLine->getTextCursor();
@ -296,9 +296,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);
}
}
@ -306,9 +305,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);
}
}
@ -317,9 +316,9 @@ namespace MWGui
{
std::vector<std::string> 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())
@ -350,7 +349,7 @@ namespace MWGui
if (mCurrent != mCommandHistory.begin())
{
--mCurrent;
mCommandLine->setCaption(*mCurrent);
mCommandLine->setOnlyText(*mCurrent);
}
}
else if (key == MyGUI::KeyCode::ArrowDown)
@ -360,10 +359,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);
}
}
}

Loading…
Cancel
Save