diff options
author | sabetts <sabetts> | 2002-02-03 00:45:18 +0000 |
---|---|---|
committer | sabetts <sabetts> | 2002-02-03 00:45:18 +0000 |
commit | f0d5e1a21cf9798300394563b9107754ad1c62ef (patch) | |
tree | cf1e5c7ee48088b92ba2da4e4af8191a4478def0 | |
parent | 5ca712fc606b1839de5bcbe80833fa9d3a17332d (diff) | |
download | ratpoison-f0d5e1a21cf9798300394563b9107754ad1c62ef.zip |
(marked_message): Fix text marking bug.
-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. */ |