[PR #17143] Improve Viewport and Viewport::WalkInBounds #31129

Open
opened 2026-01-31 09:45:18 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/17143

State: closed
Merged: Yes


This removes all of the 2D iteration machinery. Imagine the text buffer
as a Cell[w][h] grid. Clearly, this is identical to a Cell[w*h]
array, which shows that copying between overlapping ranges only needs
either forward or backward copying, and not left/right/top/down.

With WalkDir removed, WalkInBounds can be rewritten with basic
arithmetic which allows pos to be an exclusive end coordinate.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/17143 **State:** closed **Merged:** Yes --- This removes all of the 2D iteration machinery. Imagine the text buffer as a `Cell[w][h]` grid. Clearly, this is identical to a `Cell[w*h]` array, which shows that copying between overlapping ranges only needs either forward or backward copying, and not left/right/top/down. With `WalkDir` removed, `WalkInBounds` can be rewritten with basic arithmetic which allows `pos` to be an exclusive end coordinate.
claunia added the pull-request label 2026-01-31 09:45:18 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#31129