Allow most modal popups to be closed with escape

This commit is contained in:
WerWolv
2021-01-14 17:01:44 +01:00
parent 441f4a9fc7
commit 740619529c
6 changed files with 44 additions and 17 deletions

View File

@@ -14,7 +14,7 @@ namespace hex {
ContentRegistry::CommandPaletteCommands::add(
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
"#", "Calculator",
[](std::string input) {
[](auto input) {
MathEvaluator evaluator;
evaluator.registerStandardVariables();
evaluator.registerStandardFunctions();
@@ -31,6 +31,18 @@ namespace hex {
return hex::format("#%s = ???", input.data());
});
ContentRegistry::CommandPaletteCommands::add(
ContentRegistry::CommandPaletteCommands::Type::KeywordCommand,
"/bm", "Create Bookmark",
[](auto input) {
Bookmark bookmark;
bookmark.name.resize(64);
std::strncpy(bookmark.name.data(), input.c_str(), bookmark.name.size());
View::postEvent(Events::AddBookmark, &bookmark);
return "";
});
this->m_lastResults = this->getCommandResults("");
}