--- rxvt-unicode/src/xdefaults.C 2014/08/16 10:51:23 1.180 +++ rxvt-unicode/src/xdefaults.C 2014/09/03 18:47:16 1.182 @@ -709,19 +709,20 @@ }; int -rxvt_term::bind_action (const char *str, const char *arg) +rxvt_term::parse_keysym (const char *str, unsigned int &state) { int sym; - unsigned int state = 0; const char *key = strrchr (str, '-'); + state = 0; + if (!key) key = str; else key++; // string or key is empty - if (*arg == '\0' || *key == '\0') + if (*key == '\0') return -1; // parse modifiers @@ -756,9 +757,20 @@ return -1; } + return sym; +} + +int +rxvt_term::bind_action (const char *str, const char *arg) +{ + int sym; + unsigned int state; + + if (*arg == '\0' || (sym = parse_keysym (str, state)) == -1) + return -1; + wchar_t *ws = rxvt_mbstowcs (arg); - if (!HOOK_INVOKE ((this, HOOK_REGISTER_COMMAND, DT_INT, sym, DT_INT, state, DT_WCS_LEN, ws, wcslen (ws), DT_END))) - keyboard->register_action (sym, state, ws); + keyboard->register_action (sym, state, ws); free (ws); return 1;