From 57ad2dd0fbf5292cf6b9386544272414d34d0da3 Mon Sep 17 00:00:00 2001 From: truelight Date: Sat, 28 Apr 2007 10:41:00 +0000 Subject: (svn r9731) -Fix [FS#677]: in news history, newlines weren't replaced with spaces, making it look ugly from time to time --- src/news_gui.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/news_gui.cpp b/src/news_gui.cpp index 0bfb21b4c..bf9d13daf 100644 --- a/src/news_gui.cpp +++ b/src/news_gui.cpp @@ -620,15 +620,21 @@ static void DrawNewsString(int x, int y, uint16 color, const NewsItem *ni, uint * from it such as big fonts, etc. */ ptr = buffer; dest = buffer2; + WChar c_last = '\0'; for (;;) { WChar c = Utf8Consume(&ptr); if (c == 0) break; - if (c == '\r') { + /* Make a space from a newline, but ignore multiple newlines */ + if (c == '\n' && c_last != '\n') { + dest[0] = ' '; + dest++; + } else if (c == '\r') { dest[0] = dest[1] = dest[2] = dest[3] = ' '; dest += 4; } else if (IsPrintable(c)) { dest += Utf8Encode(dest, c); } + c_last = c; } *dest = '\0'; -- cgit v1.2.3-70-g09d2