From 4bc136be887e02cdcf8e5651b19fa67b0878f658 Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Mon, 24 May 2010 21:04:42 +0200 Subject: [PATCH] Bugfix: $alignr had some problems after commit 40452c971295b60f936a87dafcb2ba80fa266ee2 Example: TEXT alfa bravo charlie ${alignr}delta echo ${alignr}foxtrot Note to self: It could be that this fix brings back part of the bug that 40452c971295b60f936a87dafcb2ba80fa266ee2 fixed. Check this ! --- src/conky.cc | 3 ++- src/text_object.cc | 1 + src/text_object.h | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/conky.cc b/src/conky.cc index c2b65edb..16eef1e4 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -788,7 +788,8 @@ void generate_text_internal(char *p, int p_max_size, struct text_object root) #ifdef BUILD_ICONV iconv_convert(&a, buff_in, p, p_max_size); #endif /* BUILD_ICONV */ - substitute_newlines(p, a - 2); + if (!obj->verbatim_output) + substitute_newlines(p, a - 2); p += a; p_max_size -= a; (*p) = 0; diff --git a/src/text_object.cc b/src/text_object.cc index 4663451d..efb6dd4d 100644 --- a/src/text_object.cc +++ b/src/text_object.cc @@ -197,6 +197,7 @@ int ifblock_stack_empty(void **opaque) void obj_be_plain_text(struct text_object *obj, const char *text) { obj->data.s = strdup(text); + obj->verbatim_output = 1; memset(&obj->callbacks, 0, sizeof(obj->callbacks)); obj->callbacks.print = &gen_print_obj_data_s; diff --git a/src/text_object.h b/src/text_object.h index 8681160e..d1c958f7 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -85,6 +85,9 @@ struct text_object { long l; /* some long integer */ } data; + /* if non-zero, no substitute_newlines() is applied to object's output */ + char verbatim_output; + void *special_data; long line; struct obj_cb callbacks;