mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-01 12:31:59 +00:00
ADD: ConsoleColor_StringLength() to get the normal string length that doesn't count the escape/markup
This commit is contained in:
parent
fe8ce31c19
commit
d5a58ef206
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user