From d22b5d2363ed8a90960446a209482180f6d27fc0 Mon Sep 17 00:00:00 2001 From: BossCode45 Date: Wed, 23 Aug 2023 21:32:50 +1200 Subject: feat: Added documentation Also fixed up the special cases for keybinds, such as SPC, ESC, RET, -, and +. --- keybinds.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'keybinds.cpp') diff --git a/keybinds.cpp b/keybinds.cpp index 2e4ebe2..c41452f 100644 --- a/keybinds.cpp +++ b/keybinds.cpp @@ -168,7 +168,7 @@ const Keybind KeybindsModule::emacsBindMode(string bindString) Keybind bind; bind.modifiers = 0; - const std::regex keyRegex("^(?:([CMs])-)?(?:([CMs])-)?(?:([CMs])-)?([^\s]|(SPC|ESC|RET|))$"); + const std::regex keyRegex("^(?:([CMs])-)?(?:([CMs])-)?(?:([CMs])-)?([^\\s]|(SPC|ESC|RET|))$"); std::smatch keyMatch; if(std::regex_match(bindString, keyMatch, keyRegex)) { @@ -203,10 +203,14 @@ const Keybind KeybindsModule::emacsBindMode(string bindString) { if(keyMatch[4].str() == "RET") keySym = XK_Return; - if(keyMatch[4].str() == "ESC") + else if(keyMatch[4].str() == "ESC") keySym = XK_Escape; - if(keyMatch[4].str() == "SPC") + else if(keyMatch[4].str() == "SPC") keySym = XK_space; + else if(keyMatch[4].str() == "-") + keySym = XK_minus; + else if(keyMatch[4].str() == "+") + keySym = XK_plus; else throw Err(CFG_ERR_KEYBIND, "Keybind '" + bindString + "' is invalid"); } -- cgit v1.2.3