diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/bar.c | 20 |
2 files changed, 19 insertions, 5 deletions
@@ -1,3 +1,7 @@ +2002-02-02 Shawn Betts <sabetts@vcn.bc.ca> + + * src/bar.c (marked_message): Fix text marking bug. + 2002-02-01 Shawn Betts <sabetts@vcn.bc.ca> * src/actions.c (command): bail out if alias recursion gets too deep. @@ -231,23 +231,33 @@ marked_message (char *msg, int mark_start, int mark_end) { int start; int end; + int width; - start = XTextWidth (defaults.font, msg, mark_start) + defaults.bar_x_padding; - end = XTextWidth (defaults.font, msg + mark_start, mark_end - mark_start) + defaults.bar_x_padding; + if (mark_start == 0) + start = 0; + else + start = XTextWidth (defaults.font, msg, mark_start) + defaults.bar_x_padding; - PRINT_DEBUG ("%d %d strlen(%d)==> %d %d\n", mark_start, mark_end, strlen(msg), start, end); + if (mark_end == strlen (msg)) + end = XTextWidth (defaults.font, msg, mark_end) + defaults.bar_x_padding * 2; + else + end = XTextWidth (defaults.font, msg, mark_end) + defaults.bar_x_padding; + + width = end - start; + + PRINT_DEBUG ("start = %d, end = %d, width = %d\n", start, end, width); lgv.foreground = current_screen()->fg_color; lgv.function = GXxor; mask = GCForeground | GCFunction; lgc = XCreateGC(dpy, s->root, mask, &lgv); - XFillRectangle (dpy, s->bar_window, lgc, start, 0, end, height); + XFillRectangle (dpy, s->bar_window, lgc, start, 0, width, height); lgv.foreground = s->bg_color; lgc = XCreateGC(dpy, s->root, mask, &lgv); - XFillRectangle (dpy, s->bar_window, lgc, start, 0, end, height); + XFillRectangle (dpy, s->bar_window, lgc, start, 0, width, height); } /* Keep a record of the message. */ |