Missing invalidation in some weird case
There's a missing (well, actually miscomputed) invalidation in a really special case, involving:
- restricted scrolling with the top of the region being the top row,
- scrolling the restricted area by producing output at its bottom,
- having dragged back the scrollbar, so that it does not stick to the bottom and therefore does not trigger an
invalidate_all()
.
Run the attached script.
Wait until "restricted line 10" is printed, or optionally wait even more.
Scroll back a little bit (e.g. one line by pressing Ctrl+Shift+Up). The scrollbar no longer sticks to the bottom.
Notice that the bottom part ("line 11" etc.) is not updated as expected. Expected: below the empty line the numbers should go from 11 because they're outside of the scrolling region and don't change. Actual: they get visually wiped out one by one, resulting in bigger numbers. Scrolling, highlighting with the mouse etc. fixes the problem.
Terminal::cursor_down
goes like:
/* Force the areas below the region to be
* redrawn -- they've moved. */
invalidate_rows(start, end);
The comment says "below the region", but then the region itself is invalidated instead. Apparently the comment is correct, we should invalidate from end
downwards:
invalidate_rows(end, m_screen->insert_delta + m_row_count - 1);
This seems to fix it, to be double checked tomorrow.