Skip to content

Commit 8fb188f

Browse files
committed
Fix logic in TCellChar methods
1 parent 966226d commit 8fb188f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

include/tvision/scrncell.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,17 @@ inline void TCellChar::moveInt(uint32_t mbc, bool wide)
9191
inline void TCellChar::moveStr(TStringView mbc, bool wide)
9292
{
9393
static_assert(sizeof(_text) >= 4, "");
94-
if (mbc.size() <= 4)
94+
memset(this, 0, sizeof(*this));
95+
if (0 < mbc.size() && mbc.size() <= 4)
9596
{
96-
memset(this, 0, sizeof(*this));
97+
_flags |= -int(wide) & fWide;
9798
switch (mbc.size())
9899
{
99100
case 4: _text[3] = mbc[3];
100101
case 3: _text[2] = mbc[2];
101102
case 2: _text[1] = mbc[1];
102103
case 1: _text[0] = mbc[0];
103104
}
104-
_flags |= -int(wide) & fWide;
105105
}
106106
}
107107

@@ -127,7 +127,7 @@ constexpr inline void TCellChar::appendZeroWidth(TStringView mbc)
127127
size_t sz = size();
128128
if (mbc.size() <= sizeof(_text) - sz)
129129
{
130-
if (!mbc[0])
130+
if (_text[0] == '\0')
131131
_text[0] = ' ';
132132
switch (mbc.size())
133133
{

0 commit comments

Comments
 (0)