microsoft / microsoft/terminal

Collapsible Regions

Open
#13,298 0 comments 5 reactions 0 assignees View on GitHub
Area-TerminalControl Area-UserInterface Issue-Feature Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start with the Rendering and UI Design sections, then inspect the existing buffer, renderer, marks (#11000), and TermControl paths mentioned in the issue. Compare the referenced terminal-wg and xterm.js designs. Done requires an agreed design covering region tracking, rendering, reflow, control-layer communication, and the XAML UI before implementation can begin.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
cli, desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.