| 92 | |
| 93 | |
| 94 | void Console::notifyButtonPressed(MyGUI::Widget* _sender, MyGUI::KeyCode _key, MyGUI::Char _char) |
| 95 | { |
| 96 | MyGUI::EditBox* edit = _sender->castType<MyGUI::EditBox>(); |
| 97 | size_t len = edit->getCaption().length(); |
| 98 | if ((_key == MyGUI::KeyCode::Backspace) && (len > 0) && (mAutocomleted)) |
| 99 | { |
| 100 | edit->deleteTextSelection(); |
| 101 | len = edit->getCaption().length(); |
| 102 | edit->eraseText(len - 1); |
| 103 | } |
| 104 | |
| 105 | MyGUI::UString command = edit->getCaption(); |
| 106 | if (command.length() == 0) |
| 107 | return; |
| 108 | |
| 109 | for (auto& delegate : mDelegates) |
| 110 | { |
| 111 | if (delegate.first.find(command) == 0) |
| 112 | { |
| 113 | if (command == delegate.first) |
| 114 | break; |
| 115 | edit->setCaption(delegate.first); |
| 116 | edit->setTextSelection(command.length(), delegate.first.length()); |
| 117 | mAutocomleted = true; |
| 118 | return; |
| 119 | } |
| 120 | } |
| 121 | mAutocomleted = false; |
| 122 | } |
| 123 | |
| 124 | void Console::addToConsole(const MyGUI::UString& _line) |
| 125 | { |
nothing calls this directly
no test coverage detected