diff --git a/src/renderer/atlas/AtlasEngine.cpp b/src/renderer/atlas/AtlasEngine.cpp index 983b4cd082b..9d0cc9f4e97 100644 --- a/src/renderer/atlas/AtlasEngine.cpp +++ b/src/renderer/atlas/AtlasEngine.cpp @@ -935,6 +935,21 @@ void AtlasEngine::_recreateSizeDependentResources() _api.glyphProps = Buffer{ projectedGlyphSize }; _api.glyphAdvances = Buffer{ projectedGlyphSize }; _api.glyphOffsets = Buffer{ projectedGlyphSize }; + + // Initialize cellGlyphMapping with valid data (whitespace), so that it can be + // safely used by the TileHashMap refresh logic via makeNewest() in StartPaint(). + { + u16x2* coords{}; + AtlasKey key{ { .cellCount = 1 }, 1, L" " }; + AtlasValue value{ CellFlags::None, 1, &coords }; + + coords[0] = _r.tileAllocator.allocate(_r.glyphs); + + const auto it = _r.glyphs.insert(std::move(key), std::move(value)); + _r.glyphQueue.emplace_back(it); + + std::fill(_r.cellGlyphMapping.begin(), _r.cellGlyphMapping.end(), it); + } } if (!_r.d2dMode) @@ -1176,6 +1191,15 @@ void AtlasEngine::_flushBufferLine() // This would seriously blow us up otherwise. Expects(_api.bufferLineColumn.size() == _api.bufferLine.size() + 1); + // GH#13962: With the lack of proper LineRendition support, just fill + // the remaining columns with whitespace to prevent any weird artifacts. + for (auto lastColumn = _api.bufferLineColumn.back(); lastColumn < _api.cellCount.x;) + { + ++lastColumn; + _api.bufferLine.emplace_back(L' '); + _api.bufferLineColumn.emplace_back(lastColumn); + } + // NOTE: // This entire function is one huge hack to see if it works.