Skip to content

Commit 477b3ae

Browse files
committed
Add Unicode support in TStatusBar hints
Unicode support basically consists in replacing strlen with strwidth and char arrays with TStringView.
1 parent 9bcd897 commit 477b3ae

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

source/tvision/tstatusl.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ void TStatusLine::drawSelect( TStatusItem *selected )
6868
{
6969
TDrawBuffer b;
7070
ushort color;
71-
char hintBuf[256];
7271

7372
ushort cNormal = getColor(0x0301);
7473
ushort cSelect = getColor(0x0604);
@@ -106,15 +105,13 @@ void TStatusLine::drawSelect( TStatusItem *selected )
106105
}
107106
if( i < size.x - 2 )
108107
{
109-
strcpy( hintBuf, hint( helpCtx ) );
110-
if( *hintBuf != EOS )
108+
TStringView hintText = hint( helpCtx );
109+
if( hintText.size() )
111110
{
112111
b.moveStr( i, hintSeparator, cNormal );
113112
i += 2;
114-
if( strlen(hintBuf) + i > size.x )
115-
hintBuf[size.x-i] = EOS;
116-
b.moveStr( i, hintBuf, cNormal );
117-
i += strlen(hintBuf);
113+
b.moveStr( i, hintText, cNormal, size.x-i );
114+
i += strwidth(hintText);
118115
}
119116
}
120117
writeLine( 0, 0, size.x, 1, b );

0 commit comments

Comments
 (0)