forked from qt-creator/qt-creator
Terminal: Fix copying Japanese text
Previously if you tried to copy text such as "惣流・アスカ・ラングレー" an invalid char would be added after each character. This patch fixes the code so that "-1" cells are ignored. They are created because the previous cell had a width of 2. Change-Id: Iff8e60d3a4080068e188b08ded13a8c78df952f2 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -456,6 +456,9 @@ std::u32string::value_type TerminalSurface::fetchCharAt(int x, int y) const
|
||||
if (cell->width == 0)
|
||||
return 0;
|
||||
|
||||
if (cell->chars[0] == 0xffffffff)
|
||||
return 0;
|
||||
|
||||
QString s = QString::fromUcs4(cell->chars, 6).normalized(QString::NormalizationForm_C);
|
||||
const QList<uint> ucs4 = s.toUcs4();
|
||||
return std::u32string(ucs4.begin(), ucs4.end()).front();
|
||||
|
Reference in New Issue
Block a user