summaryrefslogtreecommitdiff
path: root/keybinds.cpp
diff options
context:
space:
mode:
authorBossCode45 <human.cyborg42@gmail.com>2023-08-23 21:32:50 +1200
committerBossCode45 <human.cyborg42@gmail.com>2023-08-23 21:32:50 +1200
commitd22b5d2363ed8a90960446a209482180f6d27fc0 (patch)
tree99ced8d93809cf675b55ea683f28f847e84d9722 /keybinds.cpp
parent6e5d3c8aec03d34b5d195cc920cc4c2f123a1cb2 (diff)
downloadYATwm-d22b5d2363ed8a90960446a209482180f6d27fc0.tar.gz
YATwm-d22b5d2363ed8a90960446a209482180f6d27fc0.zip
feat: Added documentation
Also fixed up the special cases for keybinds, such as SPC, ESC, RET, -, and +.
Diffstat (limited to 'keybinds.cpp')
-rw-r--r--keybinds.cpp10
1 files changed, 7 insertions, 3 deletions
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");
}