X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=scrotwm.c;h=44b614c5c3636470f14c13c09cc673624813852c;hb=726356b44efcb6e1d4d700bc8785c0966b95542f;hp=718c5d5e22627e68eb98334661770d31f26c9b24;hpb=bf9901fca703621db2c07b2ee7f7169c6b4b1129;p=spectrwm.git diff --git a/scrotwm.c b/scrotwm.c index 718c5d5..44b614c 100644 --- a/scrotwm.c +++ b/scrotwm.c @@ -3452,7 +3452,6 @@ search_resp_name_workspace(char *resp, unsigned long len) strerror(errno)); return; } - ws->name[len - 1] = '\0'; } } @@ -3472,7 +3471,6 @@ search_resp_search_workspace(char *resp, unsigned long len) strerror(errno)); return; } - q[len - 1] = '\0'; p = strchr(q, ':'); if (p != NULL) *p = '\0'; @@ -3504,7 +3502,7 @@ search_resp_search_window(char *resp, unsigned long len) strerror(errno)); return; } - s[len - 1] = '\0'; + idx = strtonum(s, 1, INT_MAX, &errstr); if (errstr) { DNPRINTF(SWM_D_MISC, "window idx is %s: %s", @@ -3546,6 +3544,12 @@ search_do_resp(void) goto done; } resp[rbytes] = '\0'; + + /* XXX: + * Older versions of dmenu (Atleast pre 4.4.1) do not send a + * newline, so work around that by sanitizing the resp now. + */ + resp[strcspn(resp, "\n")] = '\0'; len = strlen(resp); switch (search_resp_action) { @@ -4727,7 +4731,7 @@ setup_keys(void) setkeybinding(MODKEY|ShiftMask, XK_bracketright,kf_move_down, NULL); setkeybinding(MODKEY|ShiftMask, XK_slash, kf_name_workspace,NULL); setkeybinding(MODKEY, XK_slash, kf_search_workspace,NULL); - setkeybinding(MODKEY, XK_s, kf_search_win, NULL); + setkeybinding(MODKEY, XK_f, kf_search_win, NULL); #ifdef SWM_DEBUG setkeybinding(MODKEY|ShiftMask, XK_d, kf_dumpwins, NULL); #endif