[hackers] [dmenu] rebound paste, removed useless max widths || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Fri, 20 Aug 2010 12:50:47 +0000 (UTC)

changeset: 364:837d5ddc9819
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Fri Aug 20 13:50:44 2010 +0100
files: dmenu.1 dmenu.c
description:
rebound paste, removed useless max widths

diff -r 43ec91be3d16 -r 837d5ddc9819 dmenu.1
--- a/dmenu.1 Thu Aug 19 16:43:39 2010 +0100
+++ b/dmenu.1 Fri Aug 20 13:50:44 2010 +0100
@@ -55,7 +55,7 @@
 defines the prompt to be displayed to the left of the input field.
 .TP
 .BI \-fn " font"
-defines the font set used.
+defines the font or font set used.
 .TP
 .BI \-nb " color"
 defines the normal background color.
@@ -93,7 +93,7 @@
 .B Escape (Control\-c)
 Exit without selecting an item, returning failure.
 .TP
-.B Control\-y
+.B Shift\-Insert
 Paste the current X selection into the input field.
 .SH SEE ALSO
 .BR dwm (1)
diff -r 43ec91be3d16 -r 837d5ddc9819 dmenu.c
--- a/dmenu.c Thu Aug 19 16:43:39 2010 +0100
+++ b/dmenu.c Fri Aug 20 13:50:44 2010 +0100
@@ -83,10 +83,10 @@
                 n = mw - (promptw + inputw + dc_textw(dc, "<") + dc_textw(dc, ">"));
 
         for(i = 0, next = curr; next; next = next->right)
- if((i += (lines > 0) ? bh : MIN(dc_textw(dc, next->text), mw/3)) > n)
+ if((i += (lines > 0) ? bh : dc_textw(dc, next->text)) > n)
                         break;
         for(i = 0, prev = curr; prev && prev->left; prev = prev->left)
- if((i += (lines > 0) ? bh : MIN(dc_textw(dc, prev->left->text), mw/3)) > n)
+ if((i += (lines > 0) ? bh : dc_textw(dc, prev->left->text)) > n)
                         break;
 }
 
@@ -124,7 +124,7 @@
                         dc_drawtext(dc, "<", normcol);
                 for(item = curr; item != next; item = item->right) {
                         dc->x += dc->w;
- dc->w = MIN(dc_textw(dc, item->text), mw/3);
+ dc->w = dc_textw(dc, item->text);
                         dc_drawtext(dc, item->text, (item == sel) ? selcol : normcol);
                 }
                 dc->w = dc_textw(dc, ">");
@@ -226,9 +226,6 @@
                         while(cursor > 0 && text[nextrune(-1)] != ' ')
                                 insert(NULL, nextrune(-1) - cursor);
                         break;
- case XK_y: /* paste selection */
- XConvertSelection(dc->dpy, XA_PRIMARY, utf8, utf8, win, CurrentTime);
- return;
                 }
         }
         switch(ksym) {
@@ -266,6 +263,10 @@
                 sel = curr = matches;
                 calcoffsets();
                 break;
+ case XK_Insert: /* paste selection */
+ if(ev->state & ShiftMask)
+ XConvertSelection(dc->dpy, XA_PRIMARY, utf8, utf8, win, CurrentTime);
+ return;
         case XK_Left:
                 if(cursor > 0 && (!sel || !sel->left || lines > 0)) {
                         cursor = nextrune(-1);
@@ -480,7 +481,7 @@
         grabkeyboard();
         dc_resize(dc, mw, mh);
         inputw = MIN(inputw, mw/3);
- promptw = prompt ? MIN(dc_textw(dc, prompt), mw/5) : 0;
+ promptw = prompt ? dc_textw(dc, prompt) : 0;
         XMapRaised(dc->dpy, win);
         text[0] = '\0';
         match();
Received on Fri Aug 20 2010 - 14:50:47 CEST

This archive was generated by hypermail 2.2.0 : Fri Aug 20 2010 - 15:00:07 CEST