Console word wrap fix: only check and wrap at word boundaries, not in the middle of a word.

(Enter "r_nolerp_list" in the console for an example.)


git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@595 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
svdijk 2012-01-03 18:03:51 +00:00
parent 6dd3c40734
commit 606890402c

View file

@ -402,6 +402,7 @@ void Con_Print (const char *txt)
int c, l;
static int cr;
int mask;
qboolean boundary;
//con_backscroll = 0; //johnfitz -- better console scrolling
@ -420,17 +421,27 @@ void Con_Print (const char *txt)
else
mask = 0;
boundary = true;
while ( (c = *txt) )
{
// count word length
for (l=0 ; l< con_linewidth ; l++)
if ( txt[l] <= ' ')
break;
if (c <= ' ')
{
boundary = true;
}
else if (boundary)
{
// count word length
for (l = 0; l < con_linewidth; l++)
if (txt[l] <= ' ')
break;
// word wrap
if (l != con_linewidth && (con_x + l > con_linewidth) )
con_x = 0;
// word wrap
if (l != con_linewidth && (con_x + l > con_linewidth))
con_x = 0;
boundary = false;
}
txt++;