about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorarg@suckless.org <unknown>2008-06-02 12:19:02 +0200
committerarg@suckless.org <unknown>2008-06-02 12:19:02 +0200
commit08bcf721b436018306bdbb9fbaca87f941ee6441 (patch)
tree3c81731fb98785e9eb168f6aeb15f9beae0fc4ea
parentfc578c57e4c265cefff0a55a0ca74172a84e757d (diff)
downloaddwm-08bcf721b436018306bdbb9fbaca87f941ee6441.tar.gz
small change to drawtext
-rw-r--r--dwm.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index 8930100..ada272c 100644
--- a/dwm.c
+++ b/dwm.c
@@ -551,7 +551,7 @@ drawsquare(Bool filled, Bool empty, Bool invert, ulong col[ColLast]) {
 
 void
 drawtext(const char *text, ulong col[ColLast], Bool invert) {
-	int x, y, w, h;
+	int i, x, y, h;
 	uint len, olen;
 	XRectangle r = { dc.x, dc.y, dc.w, dc.h };
 	char buf[256];
@@ -563,16 +563,15 @@ drawtext(const char *text, ulong col[ColLast], Bool invert) {
 	olen = strlen(text);
 	len = MIN(olen, sizeof buf);
 	memcpy(buf, text, len);
-	w = 0;
 	h = dc.font.ascent + dc.font.descent;
 	y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
 	x = dc.x + (h / 2);
 	/* shorten text if necessary */
-	for(; len && (w = textnw(buf, len)) > dc.w - h; len--);
+	for(; len && (i = textnw(buf, len)) > dc.w - h; len--);
 	if(!len)
 		return;
 	if(len < olen)
-		memcpy(&buf[MAX(0, len - 3)], "...", 3);
+		for(i = len; i >= MAX(0, len - 3); buf[i--] = '.');
 	XSetForeground(dpy, dc.gc, col[invert ? ColBG : ColFG]);
 	if(dc.font.set)
 		XmbDrawString(dpy, dc.drawable, dc.font.set, dc.gc, x, y, buf, len);
mmitter Drew DeVault <sir@cmpwn.com> 2019-03-14 21:37:00 -0400 Lay out message list widget basic design' href='/akspecs/aerc/commit/widgets/msglist.go?h=0.4.0&id=0f8b7a1203309ebec0dc78baf3f195671eadac2d'>0f8b7a1 ^
5685a17 ^
32f970e ^






0f8b7a1 ^

fcdcd32 ^
0f8b7a1 ^
32f970e ^


0f8b7a1 ^








0f8b7a1 ^
5685a17 ^
0f8b7a1 ^


e780c6e ^
0f8b7a1 ^

f1698a3 ^

0f8b7a1 ^




11f0a72 ^
0f8b7a1 ^


f1698a3 ^


de36484 ^
0f8b7a1 ^






de36484 ^




5f651b3 ^

32f970e ^
84965d6 ^
0f8b7a1 ^
5f651b3 ^
f1698a3 ^
4465646 ^

5f651b3 ^










de36484 ^
fca7321 ^



da62f63 ^


fca7321 ^
0f8b7a1 ^



f1698a3 ^
89ffd86 ^
8a42dfc ^



0f8b7a1 ^
f1698a3 ^
0f8b7a1 ^



0f8b7a1 ^

e780c6e ^



312a53e ^
f1698a3 ^
312a53e ^

f1698a3 ^

1303273 ^





408a9e7 ^
1303273 ^

fa5d8d7 ^

408a9e7 ^
fa5d8d7 ^

1303273 ^
312a53e ^
f1698a3 ^
91a75cd ^
312a53e ^


ef6178a ^
f9251c2 ^
52a97c0 ^
52a97c0 ^
a15ea01 ^
0f8b7a1 ^

1303273 ^
f1698a3 ^
0f8b7a1 ^




24daef8 ^
312a53e ^
a15ea01 ^
312a53e ^

3cd0d5b ^
f1698a3 ^

3cd0d5b ^

cce7cb4 ^
f1698a3 ^
32f970e ^
312a53e ^

13ba53c ^
f1698a3 ^
32f970e ^
bf02ad3 ^
13ba53c ^

32f970e ^
f1698a3 ^
a275f65 ^
f1698a3 ^
0b26241 ^

52a97c0 ^
bf02ad3 ^

52a97c0 ^
bf02ad3 ^

52a97c0 ^


24daef8 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206