diff --git a/src/gfx_layout.cpp b/src/gfx_layout.cpp --- a/src/gfx_layout.cpp +++ b/src/gfx_layout.cpp @@ -888,6 +888,12 @@ Layouter::LineCacheItem &Layouter::GetCa linecache = new LineCache(); } + if (auto match = linecache->find(LineCacheQuery{state, std::string_view{str, len}}); + match != linecache->end()) { + return match->second; + } + + /* Create missing entry */ LineCacheKey key; key.state_before = state; key.str.assign(str, len);