From 2fd832f6b023cfeb71ff2c2d1877f77908bb3206 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Thu, 19 Jun 2008 19:57:12 +0000 Subject: [PATCH] Refactored out some redundancy in the tab conversion code git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1169 7f574dfc-610e-0410-a909-a81674777703 --- src/conky.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/conky.c b/src/conky.c index 6c7cfc0..fd8a0c2 100644 --- a/src/conky.c +++ b/src/conky.c @@ -6633,8 +6633,8 @@ static void draw_string(const char *s) /* This code looks for tabs in the text and coverts them to spaces. * The trick is getting the correct number of spaces, and not going * over the window's size without forcing the window larger. */ - for (i = 0; i < (int)text_buffer_size; i++) { - if (tmpstring1[i] == '\t') { // 9 is ascii tab + for (i = 0; i < (int) text_buffer_size; i++) { + if (tmpstring1[i] == '\t') { i2 = 0; for (i2 = 0; i2 < (8 - (1 + pos) % 8) && added <= max; i2++) { /* guard against overrun */ @@ -6643,11 +6643,9 @@ static void draw_string(const char *s) } pos += i2; } else { - if (tmpstring1[i] != 9) { - /* guard against overrun */ - tmpstring2[MIN(pos, (int)text_buffer_size - 1)] = tmpstring1[i]; - pos++; - } + /* guard against overrun */ + tmpstring2[MIN(pos, (int) text_buffer_size - 1)] = tmpstring1[i]; + pos++; } } #ifdef X11 -- 1.7.9.5