diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-05-26 18:47:20 +0200 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-05-26 18:47:20 +0200 |
commit | fc8e95ed136758206f09c8041195821e3c4193a1 (patch) | |
tree | 9499262ed17305fe52ed073b49cbcb5223e52be1 /src | |
parent | 57ab5caed726ee6bacc5c5807345c0cfaa1ba25f (diff) | |
download | ratpoison-fc8e95ed136758206f09c8041195821e3c4193a1.zip |
draw_string: only call rp_text_width when needed
Diffstat (limited to 'src')
-rw-r--r-- | src/bar.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -377,15 +377,21 @@ draw_string (rp_screen *s, char *msg, int mark_start, int mark_end) draw_partial_string (s, msg + start, part_len, x_offset, y_offset, style); - x_offset += rp_text_width (s, msg + start, part_len); - start = i; + /* Adjust coordinates. */ if (print_reason & REASON_NEWLINE) { - start++; x_offset = 0; y_offset++; + /* Skip newline. */ + start = i + 1; } + else + { + x_offset += rp_text_width (s, msg + start, part_len); + start = i; + } + print_reason = REASON_NONE; } style = next_style; |