From 07d1d01afc6082092782452d1b793c3d1e60c6a6 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Thu, 11 Apr 2013 21:45:28 +0200 Subject: [PATCH] Fix resize freeze on full-width chars in Terminal history In the Terminal data model every full width character occupies two cells in the data buffers. The second cell of such characters is not drawn and used mainly to differentiate between full width and half width characters. Proposed fix zeroes the attributes of the second cell in the HistoryBuffer::GetTerminalLineAt() that prevents the potential endless loops in the BasicTerminalBuffer::_ResizeRedraw(). Those loops were result of the random attributes in full width character's second cells. --- src/apps/terminal/HistoryBuffer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apps/terminal/HistoryBuffer.cpp b/src/apps/terminal/HistoryBuffer.cpp index 3202c5a0af..ada86f5deb 100644 --- a/src/apps/terminal/HistoryBuffer.cpp +++ b/src/apps/terminal/HistoryBuffer.cpp @@ -121,7 +121,9 @@ HistoryBuffer::GetTerminalLineAt(int32 index, TerminalLine* buffer) const // full width char? if (cell.character.IsFullWidth()) { cell.attributes |= A_WIDTH; - charCount++; + // attributes of the second, "invisible" cell must be + // cleared to let full-width chars detection work properly + buffer->cells[charCount++].attributes = 0; } }