From 4435a165b7328ffd679989a75dae827c047edef0 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sun, 31 Jul 2005 19:49:39 +0000 Subject: [PATCH] fixed tab code, changed $tab to $offset git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky@36 7f574dfc-610e-0410-a909-a81674777703 --- README | 2 +- conky.c | 25 +++++++++++++------------ conkyrc.sample | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/README b/README index fb5750f3..b5dee948 100644 --- a/README +++ b/README @@ -271,7 +271,7 @@ swapmax Total amount of swap swapperc Percentage of swap in use sysname System name, Linux for example - tab pixels Move text over by N pixels + offset pixels Move text over by N pixels tail logfile, lines (interval) Displays last N lines of supplied text text file. If interval is not supplied, diff --git a/conky.c b/conky.c index f22dad68..e4473d27 100644 --- a/conky.c +++ b/conky.c @@ -216,7 +216,7 @@ enum { ALIGNR, ALIGNC, GRAPH, - TAB, + OFFSET, }; static struct special_t { @@ -385,9 +385,9 @@ static inline void new_outline(char *buf, long c) new_special(buf, OUTLINE)->arg = c; } -static inline void new_tab(char *buf, long c) +static inline void new_offset(char *buf, long c) { - new_special(buf, TAB)->arg = c; + new_special(buf, OFFSET)->arg = c; } static inline void new_alignr(char *buf, long c) @@ -489,7 +489,7 @@ enum text_object_type { OBJ_fs_used, OBJ_fs_used_perc, OBJ_hr, - OBJ_tab, + OBJ_offset, OBJ_alignr, OBJ_alignc, OBJ_i2c, @@ -857,7 +857,7 @@ static void construct_text_object(const char *s, const char *arg) arg = "/"; obj->data.fs = prepare_fs_stat(arg); END OBJ(hr, 0) obj->data.i = arg ? atoi(arg) : 1; - END OBJ(tab, 0) obj->data.i = arg ? atoi(arg) : 1; + END OBJ(offset, 0) obj->data.i = arg ? atoi(arg) : 1; END OBJ(i2c, INFO_I2C) char buf1[64], buf2[64]; int n; @@ -1679,8 +1679,8 @@ static void generate_text() OBJ(hr) { new_hr(p, obj->data.i); } - OBJ(tab) { - new_tab(p, obj->data.i); + OBJ(offset) { + new_offset(p, obj->data.i); } OBJ(i2c) { double r; @@ -2454,7 +2454,7 @@ static void text_size_updater(char *s) h += font_ascent(); } } - + special_index++; s = p + 1; } @@ -2819,11 +2819,12 @@ static void draw_line(char *s) arg); break; - case TAB: + case OFFSET: { - int pos_x = text_start_x + text_width - cur_x - 1; - if ( pos_x > specials[special_index].arg) - w = pos_x - specials[special_index].arg; + w = text_start_x + specials[special_index].arg; + printf("w %i width %i\n", w, text_width); + if ((w + get_string_width(p)) > text_width) + w = text_width - get_string_width(p); } break; diff --git a/conkyrc.sample b/conkyrc.sample index 8a3a14a1..ed2337d9 100644 --- a/conkyrc.sample +++ b/conkyrc.sample @@ -256,7 +256,7 @@ metar_station CYBW # swapmax Total amount of swap # swapperc Percentage of swap in use # sysname System name, Linux for example -# tab pixels Move text over by N pixels +# offset pixels Move text over by N pixels # tail logfile, lines (interval) # Displays last N lines of supplied text # text file. If interval is not supplied,