mirror of
https://github.com/microsoft/terminal.git
synced 2026-11-16 09:10:27 +00:00
While the changes are complex, they are straightforward, except for one bit: The complete refactor of `ScrollRows`. The reason it became necessary is that moving the viewport to the top during `ClearScrollback` may wrap the source range across the buffer's end. VT/conhost scrolling keeps src/dst ranges within logical bounds, where choosing the copy direction is sufficient. For instance: Imagine we have physical rows `A B C` and I call `ScrollRows(2, 2, -2)` then this should result in `C, A, C`. However, the old logic would produce `C C C`, because it copies `2 (C) -> 0 (A)` and then `0 (A) -> 1 (B)`. By the time the 2nd copy runs, the contents of row A have already been overwritten by C. This is the classic difference between a `memmove` and a `scroll array`. `ScrollRows` has never been an actual scroll function. The name stems more from `ScrollConsoleScreenBuffer`, which turn refers to historical bit blit scrolling. Part of #18290 ## Validation Steps Performed * `cls` = memory use 📉