From f7040845394d70aba20785c9ad42bba2d92daae2 Mon Sep 17 00:00:00 2001 From: Sander van Dijk Date: Tue, 3 Jan 2012 18:03:51 +0000 Subject: [PATCH] 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://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@595 af15c1b1-3010-417e-b628-4374ebc0bcbd --- Quake/console.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Quake/console.c b/Quake/console.c index f9873a42..28ae555a 100644 --- a/Quake/console.c +++ b/Quake/console.c @@ -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++;