Skip to content

Commit

Permalink
Add Unicode support in TStatusBar hints
Browse files Browse the repository at this point in the history
Unicode support basically consists in replacing strlen with strwidth and char arrays with TStringView.
  • Loading branch information
magiblot committed Aug 20, 2020
1 parent 9bcd897 commit 477b3ae
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions source/tvision/tstatusl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ void TStatusLine::drawSelect( TStatusItem *selected )
{
TDrawBuffer b;
ushort color;
char hintBuf[256];

ushort cNormal = getColor(0x0301);
ushort cSelect = getColor(0x0604);
Expand Down Expand Up @@ -106,15 +105,13 @@ void TStatusLine::drawSelect( TStatusItem *selected )
}
if( i < size.x - 2 )
{
strcpy( hintBuf, hint( helpCtx ) );
if( *hintBuf != EOS )
TStringView hintText = hint( helpCtx );
if( hintText.size() )
{
b.moveStr( i, hintSeparator, cNormal );
i += 2;
if( strlen(hintBuf) + i > size.x )
hintBuf[size.x-i] = EOS;
b.moveStr( i, hintBuf, cNormal );
i += strlen(hintBuf);
b.moveStr( i, hintText, cNormal, size.x-i );
i += strwidth(hintText);
}
}
writeLine( 0, 0, size.x, 1, b );
Expand Down

0 comments on commit 477b3ae

Please sign in to comment.