1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-10-03 07:29:10 +00:00

Revert "Fix multiline strings displayed on 1 line when output to x is not used"

This reverts commit 5967d28511.
This commit is contained in:
Brenden Matthews 2009-07-20 17:46:22 -06:00
parent 63a25aae03
commit 5d0e3922aa

View File

@ -6353,35 +6353,27 @@ static void draw_string(const char *s)
int i, i2, pos, width_of_s; int i, i2, pos, width_of_s;
int max = 0; int max = 0;
int added; int added;
char *s_with_newlines;
if (s[0] == '\0') { if (s[0] == '\0') {
return; return;
} }
width_of_s = get_string_width(s); width_of_s = get_string_width(s);
s_with_newlines = strdup(s);
for(i = 0; i < width_of_s; i++) {
if(s_with_newlines[i] == SECRIT_MULTILINE_CHAR) {
s_with_newlines[i] = '\n';
}
}
if ((output_methods & TO_STDOUT) && draw_mode == FG) { if ((output_methods & TO_STDOUT) && draw_mode == FG) {
printf("%s\n", s_with_newlines); printf("%s\n", s);
if (extra_newline) fputc('\n', stdout); if (extra_newline) fputc('\n', stdout);
fflush(stdout); /* output immediately, don't buffer */ fflush(stdout); /* output immediately, don't buffer */
} }
if ((output_methods & TO_STDERR) && draw_mode == FG) { if ((output_methods & TO_STDERR) && draw_mode == FG) {
fprintf(stderr, "%s\n", s_with_newlines); fprintf(stderr, "%s\n", s);
fflush(stderr); /* output immediately, don't buffer */ fflush(stderr); /* output immediately, don't buffer */
} }
if ((output_methods & OVERWRITE_FILE) && draw_mode == FG && overwrite_fpointer) { if ((output_methods & OVERWRITE_FILE) && draw_mode == FG && overwrite_fpointer) {
fprintf(overwrite_fpointer, "%s\n", s_with_newlines); fprintf(overwrite_fpointer, "%s\n", s);
} }
if ((output_methods & APPEND_FILE) && draw_mode == FG && append_fpointer) { if ((output_methods & APPEND_FILE) && draw_mode == FG && append_fpointer) {
fprintf(append_fpointer, "%s\n", s_with_newlines); fprintf(append_fpointer, "%s\n", s);
} }
free(s_with_newlines);
memset(tmpstring1, 0, text_buffer_size); memset(tmpstring1, 0, text_buffer_size);
memset(tmpstring2, 0, text_buffer_size); memset(tmpstring2, 0, text_buffer_size);
strncpy(tmpstring1, s, text_buffer_size - 1); strncpy(tmpstring1, s, text_buffer_size - 1);