In 4.4 (and 4.4.1), dmenu starting printing spurious newlines. The problem seems to be a switch from fputs to puts; here's a patch that reverts this change.

Apologies if the newlines were an intentional side-effect of this change; I checked the mailing list for the two weeks around the change but didn't see any discussion of it.

~d

diff -r bb15b563f7af dmenu.c
--- a/dmenu.c   Wed Nov 23 15:17:32 2011 +0100
+++ b/dmenu.c   Tue Dec 06 03:34:33 2011 -0500
@@ -351,7 +351,9 @@
                break;
        case XK_Return:
        case XK_KP_Enter:
-               puts((sel && !(ev->state & ShiftMask)) ? sel->text : text);
+               /* prefer fputs, which does not change the selected text, to
+                * puts, which appends a newline */
+               fputs((sel && !(ev->state & ShiftMask)) ? sel->text : text, 
stdout);
                exit(EXIT_SUCCESS);
        case XK_Right:
                if(text[cursor] != '\0') {

Reply via email to