From 4aca8240e5ed3b3fef006948cdcc51f1d5aa3324 Mon Sep 17 00:00:00 2001 From: Evil Eye Date: Thu, 6 Jun 2019 22:09:45 +0200 Subject: [PATCH] implement ^W and ^U in the console --- apps/openmw/mwgui/console.cpp | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index 705e281381..cc900350d1 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -229,7 +229,27 @@ namespace MWGui MyGUI::KeyCode key, MyGUI::Char _char) { - if( key == MyGUI::KeyCode::Tab) + if(MyGUI::InputManager::getInstance().isControlPressed()) + { + if(key == MyGUI::KeyCode::W) + { + std::string text = mCommandLine->getCaption(); + if(text.empty()) + return; + size_t max = text.size(); + while(max > 0 && (text[max - 1] == ' ' || text[max - 1] == '\t' || text[max - 1] == '>')) + max--; + while(max > 0 && text[max - 1] != ' ' && text[max - 1] != '\t' && text[max - 1] != '>') + max--; + text.resize(max); + mCommandLine->setCaption(text); + } + else if(key == MyGUI::KeyCode::U) + { + mCommandLine->setCaption(""); + } + } + else if(key == MyGUI::KeyCode::Tab) { std::vector matches; listNames();