mirror of
https://github.com/AppleWin/AppleWin.git
synced 2025-01-19 13:32:36 +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 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 __________________________________________________________________
|
// Globals __________________________________________________________________
|
||||||
|
|
||||||
// Buffer
|
// Buffer
|
||||||
|
Loading…
x
Reference in New Issue
Block a user