summaryrefslogtreecommitdiffstats
path: root/draw.c
diff options
context:
space:
mode:
Diffstat (limited to 'draw.c')
-rw-r--r--draw.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/draw.c b/draw.c
index 383e130..066a0bf 100644
--- a/draw.c
+++ b/draw.c
@@ -28,7 +28,7 @@ drawtext(const char *text, Bool invert, Bool border)
{
int x, y, w, h;
static char buf[256];
- unsigned int len;
+ unsigned int len, olen;
XGCValues gcv;
XPoint points[5];
XRectangle r = { dc.x, dc.y, dc.w, dc.h };
@@ -56,7 +56,7 @@ drawtext(const char *text, Bool invert, Bool border)
if(!text)
return;
- len = strlen(text);
+ olen = len = strlen(text);
if(len >= sizeof(buf))
len = sizeof(buf) - 1;
memcpy(buf, text, len);
@@ -69,6 +69,14 @@ drawtext(const char *text, Bool invert, Bool border)
/* shorten text if necessary */
while(len && (w = textnw(buf, len)) > dc.w - h)
buf[--len] = 0;
+ if(len < olen) {
+ if(len > 3)
+ memcpy(buf + len - 4, "...\0", 4);
+ else if(len > 2)
+ memcpy(buf + len - 3, "..\0", 3);
+ else if(len > 1)
+ memcpy(buf + len - 2, ".\0", 2);
+ }
if(w > dc.w)
return; /* too long */
avatar' /> Hiltjo Posthuma 2-11/+10 True, False are X11-specific, make sure to use c99 stdbool for program-specific things. ... also remove left-over vim mode string in config. 2015-09-27config.mk: fix _XOPEN_SOURCE=700 for getline()Gravatar Hiltjo Posthuma 1-1/+1 2015-09-27config.mk: improve feature test checkGravatar Hiltjo Posthuma 1-1/+1 this fixes a crash on NetBSD because it requires -D_XOPEN_SOURCE (strdup, usleep). thanks k0ga and stateless for reporting and fixing this issue! 2015-08-06Fixed typo introduced by shared codeGravatar Eric Pruitt 1-1/+1 2015-07-19stest: get rid of getopt, use suckless arg.hGravatar Hiltjo Posthuma 3-53/+141 ... also some style improvements. 2015-07-19config.mk: add FREETYPELIBS and FREETYPEINCGravatar Hiltjo Posthuma 1-3/+9 These variables make it simpler to change the paths to this for ports. `pkg-config` is avoided because it sucks, in particular for cross-compilation. A commented path for *BSD is added, the Xft includes are located at: /usr/X11R6/include there. Also already bump the version number to 4.6, a release will come approximately in August. 2015-07-19fix prompt color style how it used to beGravatar Hiltjo Posthuma 1-1/+1 This is the style how it was before the big Xft change. The colors were inverted, this was not the case before the change. Reported by "zvz" on #suckless IRC, thanks! 2015-06-27Use libdraw: add Xft and fallback-fonts support to graphics libGravatar Hiltjo Posthuma 11-316/+684 - libdraw, util: add drw.{c,h}, util.{c,h} and update code. - libdraw: fix drw_rect(): use w and h parameter. - libdraw: print errstr if last character in string was ":" (sbase). - libdraw: drw_clr_free() allow valid free(NULL). - config.def.h: set default font to monospace. - cleanup() on exit. - LICENSE: update license string for dmenu -v to 2015. - LICENSE: add myself to LICENSE 2014-09-17applied Hiltjo's patch as suggested on the ml to fix ControlMask for C-j and C-mGravatar Anselm R Garbe 2-2/+5 2014-07-30fix crash with ctrl-enter as inputGravatar Hiltjo Posthuma 1-1/+2 reproduce: ./dmenu; send EOF; press ctrl+enter. 2014-05-29updated copyright notices in LICENSE and dmenu.c fileGravatar Anselm R Garbe 2-2/+2 2013-08-13applied Martin Kühl's inverse matching flag to stestGravatar Anselm R Garbe 2-4/+7 2013-08-02applied Martti Kühne's dmenu monitor patchGravatar Anselm R Garbe 3-4/+14 https://gist.github.com/mar77i/3349298/raw/f6581ca96627f4c71c0bd1faf531daaf2a613b95/monarg.patch becomes upstream now 2013-06-28accepted vi'is exit approach ^[ (suggested by Arkaduisz)Gravatar Anselm R Garbe 1-0/+2