diff --git a/src/host/readDataCooked.cpp b/src/host/readDataCooked.cpp index dd3d246645..ee862a03ae 100644 --- a/src/host/readDataCooked.cpp +++ b/src/host/readDataCooked.cpp @@ -1313,6 +1313,15 @@ COOKED_READ_DATA::LayoutResult COOKED_READ_DATA::_layoutLine(std::wstring& outpu til::CoordType cols = 0; const auto len = textBuffer.FitTextIntoColumns(text, columnLimit - column, cols); + // GH#19922: We need to account for terminals that are just 1 column wide, as we may deadlock otherwise. + // `columnLimit - column == 1` will then prevent `FitTextIntoColumns` from fitting any wide glyphs. + // We can detect this by checking for `len == 0`, skip the offending glyph and break out of the deadlock. + if (len == 0) [[unlikely]] + { + it += textBuffer.GraphemeNext(text, 0); + break; + } + output.append(text, 0, len); column += cols; it += len;