Changeset - r6542:a88998010c31
[Not reviewed]
master
0 1 0
truelight - 17 years ago 2007-04-28 10:41:00
truelight@openttd.org
(svn r9731) -Fix [FS#677]: in news history, newlines weren't replaced with spaces, making it look ugly from time to time
1 file changed with 7 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/news_gui.cpp
Show inline comments
 
@@ -620,15 +620,21 @@ static void DrawNewsString(int x, int y,
 
	 * 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';
0 comments (0 inline, 0 general)