Skip to content

Fix crash/warn on history reflow

When the last line in history was marked as wrapped, the history reflow algorithm could try to make an out-of-bound access.

These were found via repeteadly zooming-in and out in the amp.rs editor (available through Rust's cargo tool). amp.rs writes in the normal buffer (not in the alternate buffer).

While at it, add a Q_ASSERT in HistoryScrollFile::startOfLine() to ensure parameters are in range. Note that after an addCells()/addLine() pair, HistoryScrollFile::startOfLine(getLines) always has the same value as _cells.len().

BUG: 436916

Merge request reports