Collapsible Regions #17709

Open
opened 2026-01-31 05:51:05 +00:00 by claunia · 0 comments
Owner

Originally created by @zadjii-msft on GitHub (Jun 14, 2022).

Writing notes on GH for posterity

Reference

Nested trees is super hard / probably a bad idea.

The cool idea is syncing this up with marks #11000, and how those two work together. We could collapse individual commands.

Implementation

Rendering a collapsed region might need a dev spec

  • I'm not sure the right way for us to just... remove the line from the buffer. It has to be there, but we need to skip it essentially. How do we do that performantly? Track in the first line of the region "I'm a collapsed region of N lines", and have the renderer then skip ahead N to read the next line? that might work...
  • But what about when the very first row of the mutable viewport is part of a region that's collapsed? we'd need to work back up to the row that the region started on. Unless we track the row that this collapsed row belongs to...
  • Of course, how does this work with reflow?
  • Circling the buffer?
  • Collapsed text in the mutable viewport is still writable. That's maybe weird - ^[H could take the cursor inside a collapsed region

Furthermore, how do we communicate these regions up to the control layer, for it to overlay UI?

UI Design

We might definitely need to have a gutter on the left to provide a UI for this. I've already been thinking about using the gutter for marks. Should the padding be used for the gutter? Or should the gutter be in addition to padding? Cause 1dip of padding on the left is not gonna be enough for these UI elements

We should probably do the UI elements in XAML, in TermControl.

Originally created by @zadjii-msft on GitHub (Jun 14, 2022). Writing notes on GH for posterity ### Reference * Collapsable regions [terminal-wg/specifications#3](https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/3) * https://github.com/xtermjs/xterm.js/issues/1875 * Semantic markers for prompts [terminal-wg/specifications#4](https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/4) Nested trees is super hard / probably a bad idea. The cool idea is syncing this up with marks #11000, and how those two work together. We could collapse individual commands. ### Implementation Rendering a collapsed region might need a dev spec - I'm not sure the right way for us to just... remove the line from the buffer. It has to be there, but we need to skip it essentially. How do we do that performantly? Track in the first line of the region "I'm a collapsed region of N lines", and have the renderer then skip ahead N to read the next line? _that might work..._ - But what about when the very first row of the mutable viewport is part of a region that's collapsed? we'd need to work back up to the row that the region started on. Unless we track the row that this collapsed row belongs to... - Of course, how does this work with reflow? - Circling the buffer? - Collapsed text in the mutable viewport is still writable. That's maybe weird - `^[H` could take the cursor inside a collapsed region Furthermore, how do we communicate these regions up to the control layer, for it to overlay UI? ### UI Design We might definitely need to have a gutter on the left to provide a UI for this. I've already been thinking about using the gutter for marks. Should the `padding` be used for the gutter? Or should the gutter be _in addition to_ `padding`? Cause 1dip of padding on the left is not gonna be enough for these UI elements We should probably do the UI elements in XAML, in TermControl.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17709