diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 11:56:03 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:31 +0000 |
commit | 034038c8d454d03d78d3e828bd2206b0eb054ecd (patch) | |
tree | 3c2613232d618de7e2e6116b0b6eab1fdb4c66d9 /src/ui | |
parent | a30e294034cfda3ce2a6b77158e7017d6a0d804f (diff) |
More improvements to Item_Text_Wrap, although I'm not finished :(
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/ui_shared.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 18a80ae7..f62f7385 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -4598,10 +4598,6 @@ static const char *Item_Text_Wrap( const char *text, float scale, float width ) if( eol == 0 ) eol = testlen; - // place a space at the beginning of wrapped lines to prevent silly things - if( thisline[ eol ] != '\n' ) - out[ outlen++ ] = ' '; - // copy up the the line break Com_Memcpy( &out[ outlen ], thisline, eol ); outlen += eol; @@ -4609,10 +4605,15 @@ static const char *Item_Text_Wrap( const char *text, float scale, float width ) if( outlen + 1 < sizeof( out ) ) out[ outlen++ ] = '\n'; - // if there is another line, continue colour codes on it (else die) + // if there is another line, continue colour codes + // if it is a wrapped line then add a space to prevent it masquerading as + // another server message if( thisline[ eol ] && thisline[ eol + 1 ] && outlen + 1 < sizeof( out ) ) { + if( thisline[ eol ] != '\n' && outlen + 2 < sizeof( out ) ) + out[ outlen++ ] = ' '; + if( c[ 0 ] && outlen + 3 < sizeof( out ) ) { Com_Memcpy( &out[ outlen ], c, 2 ); @@ -4629,6 +4630,7 @@ static const char *Item_Text_Wrap( const char *text, float scale, float width ) } // definitely put a newline on the end + assert( out[ outlen - 1 ] == '\n' ); if( out[ outlen - 1 ] != '\n' ) out[ outlen++ ] = '\n'; |