Commit 83113f56 authored by Tomaz  Canabrava's avatar Tomaz Canabrava
Browse files

Move isSameScript to Character

parent 238c8dc1
......@@ -174,6 +174,17 @@ public:
}
return character;
}
inline bool isSameScript(const Character &lhs) const
{
const QChar::Script script = QChar::script(lhs.baseCodePoint());
const QChar::Script currentScript = QChar::script(baseCodePoint());
if (currentScript == QChar::Script_Common || script == QChar::Script_Common || currentScript == QChar::Script_Inherited
|| script == QChar::Script_Inherited) {
return true;
}
return currentScript == script;
};
};
constexpr bool operator==(const Character &a, const Character &b)
......
......@@ -119,14 +119,6 @@ void TerminalPainter::drawContents(Character *image,
const auto hasSameLineDrawStatus = [&](int column) {
return LineBlockCharacters::canDraw(image[display->loc(column, y)].character) == lineDraw;
};
const auto isSameScript = [&](const Character &c) {
const QChar::Script script = QChar::script(c.baseCodePoint());
if (currentScript == QChar::Script_Common || script == QChar::Script_Common || currentScript == QChar::Script_Inherited
|| script == QChar::Script_Inherited) {
return true;
}
return currentScript == script;
};
const Character &char_value = image[display->loc(x, y)];
......@@ -135,7 +127,7 @@ void TerminalPainter::drawContents(Character *image,
Character next_char = image[display->loc(x + len, y)];
if (!hasSameColors(x + len) || !hasSameRendition(x + len) || !hasSameWidth(x + len) || !hasSameLineDrawStatus(x + len)
|| !isSameScript(next_char) || !next_char.canBeGrouped(bidiEnabled, doubleWidth)) {
|| !char_value.isSameScript(next_char) || !next_char.canBeGrouped(bidiEnabled, doubleWidth)) {
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment