From d5a58ef206fd0de258d923a64dd5d65c80a972ca Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Sun, 30 Nov 2014 17:47:26 -0800 Subject: [PATCH] ADD: ConsoleColor_StringLength() to get the normal string length that doesn't count the escape/markup --- source/Debugger/Debugger_Console.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/source/Debugger/Debugger_Console.h b/source/Debugger/Debugger_Console.h index f1be9e6c..edd16927 100644 --- a/source/Debugger/Debugger_Console.h +++ b/source/Debugger/Debugger_Console.h @@ -184,6 +184,27 @@ return g; } + // Return the string length without the markup + inline int ConsoleColor_StringLength( const char *pText ) + { + const char *pSrc = pText; + /* */ int nLen = 0; + + if( pText ) + { + while( *pSrc ) + { + if( ConsoleColor_IsCharMeta( *pSrc ) ) + pSrc++; + else + nLen++; + pSrc++; + } + } + + return nLen; + } + // Globals __________________________________________________________________ // Buffer