[PR #12948] [MERGED] Experimental: add support for scrollbar marks #29307

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

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12948
Author: @zadjii-msft
Created: 4/20/2022
Status: ✅ Merged
Merged: 6/9/2022
Merged by: @zadjii-msft

Base: main ← Head: dev/migrie/f/1527-experimental-marks


📝 Commits (10+)

  • 88ff59f better align overlay, transparent to clicks now
  • 18ddace the start of a bunch of actions
  • be83255 Plumb more actions through
  • 66a5d9e Auto prompt detection on enter
  • 928002b setting to enable scrollbar marks
  • 036ebb1 Be able to mark a selection via the action, because that's handy!
  • 958dfa3 howd i miuss this
  • fb0bc53 plumb iterm2 marks thru to the control, draw on scrollbar
  • b7a8445 let the user overscroll marks to the start/end
  • df00505 clearing a selection of marks is important too

📊 Changes

40 files changed (+754 additions, -21 deletions)

View changed files

📝 src/cascadia/TerminalApp/AppActionHandlers.cpp (+49 -0)
📝 src/cascadia/TerminalControl/ControlCore.cpp (+162 -0)
📝 src/cascadia/TerminalControl/ControlCore.h (+7 -0)
📝 src/cascadia/TerminalControl/ControlCore.idl (+0 -1)
📝 src/cascadia/TerminalControl/IControlSettings.idl (+1 -0)
📝 src/cascadia/TerminalControl/ICoreState.idl (+32 -0)
📝 src/cascadia/TerminalControl/TermControl.cpp (+72 -14)
📝 src/cascadia/TerminalControl/TermControl.h (+9 -0)
📝 src/cascadia/TerminalControl/TermControl.xaml (+24 -0)
📝 src/cascadia/TerminalControl/pch.h (+1 -0)
📝 src/cascadia/TerminalCore/ICoreAppearance.idl (+9 -0)
📝 src/cascadia/TerminalCore/ICoreSettings.idl (+3 -0)
📝 src/cascadia/TerminalCore/Terminal.cpp (+138 -1)
📝 src/cascadia/TerminalCore/Terminal.hpp (+15 -0)
📝 src/cascadia/TerminalCore/TerminalApi.cpp (+6 -0)
📝 src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp (+8 -0)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.cpp (+34 -0)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.h (+14 -0)
📝 src/cascadia/TerminalSettingsModel/ActionArgs.idl (+11 -0)
📝 src/cascadia/TerminalSettingsModel/AllShortcutActions.h (+6 -0)

...and 20 more files

📄 Description

Adds support for marks in the scrollbar. These marks can be added in 3
ways:

  • Via the iterm2 OSC 1337 ; SetMark sequence
  • Via the addMark action
  • Automatically when the experimental.autoMarkPrompts per-profile
    setting is enabled.

#11000 has more tracking for the big-picture for this feature, as well
as additional follow-ups. This set of functionality seemed complete
enough to send a review for now. That issue describes these how I wish
these actions to look in the fullness of time. This is simply the v0.1
from the hackathon last month.

Actions

  • addMark: add a mark to the buffer. If there's a selection, use
    place the mark covering at the selection. Otherwise, place the mark
    on the cursor row.
    • color: a color for the scrollbar mark. This is optional - defaults
      to the foreground color of the current scheme if omitted.
  • scrollToMark
    • direction: ["first", "previous", "next", "last"]
  • clearMark: Clears marks at the current postition (either the
    selection if there is one, or the cursor position.
  • clearAllMarks: Don't think this needs explanation.

Per-profile settings

  • experimental.autoMarkPrompts: bool, default false.
  • experimental.showMarksOnScrollbar: bool

PR Checklist

Detailed Description of the Pull Request / Additional comments

This is basically hackathon code. It's experimental! That's okay! We'll
figure the rest of the design in post.

Theoretically, I should make these actions experimental. as well, but
it seemed like since the only way to see these guys was via the
experimental.showMarksOnScrollbar setting, you've already broken
yourself into experimental jail, and you know what you're doing.

Things that won't work as expected:

  • resizing, ESPECIALLY reflowing
  • Clearing the buffer with ED sequences / Clear Buffer

I could theoretically add velocity around this in the TermControl
layer. Always prevent marks from being visible, ignore all the actions.
Marks could still be set by VT and automark, but they'd be useless.

Next up priorities:

  • Making this work with the FinalTerm sequences
  • properly speccing
  • adding support for showMarksOnScrollbar: flags(categories), so you
    can only display errors on the scrollbar
  • adding the category flag to the addMark action

Validation Steps Performed

I like using it quite a bit. The marks can get noisy if you have them
emitted on every prompt and the buffer has 9000 lines. But that's the
beautiful thing, the actions work even if the marks aren't visible, so
you can still scroll between prompts.

Settings blob
// actions
        { "keys": "ctrl+up", "command": { "action": "scrollToMark", "direction": "previous" }, "name": "Previous mark" },
        { "keys": "ctrl+down", "command": { "action": "scrollToMark", "direction": "next" }, "name": "Next mark" },
        { "keys": "ctrl+pgup", "command": { "action": "scrollToMark", "direction": "first" }, "name": "First mark" },
        { "keys": "ctrl+pgdn", "command": { "action": "scrollToMark", "direction": "last" }, "name": "Last mark" },
        { "command": { "action": "addMark" } },
        { "command": { "action": "addMark", "color": "#ff00ff" } },
        { "command": { "action": "addMark", "color": "#0000ff" } },
        { "command": { "action": "clearAllMarks" } },

// profiles.defaults
        "experimental.autoMarkPrompts": true,
        "experimental.showMarksOnScrollbar": true,

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/12948 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 4/20/2022 **Status:** ✅ Merged **Merged:** 6/9/2022 **Merged by:** [@zadjii-msft](https://github.com/zadjii-msft) **Base:** `main` ← **Head:** `dev/migrie/f/1527-experimental-marks` --- ### 📝 Commits (10+) - [`88ff59f`](https://github.com/microsoft/terminal/commit/88ff59feacda892dd5f23a321f7bee0fd9cb909f) better align overlay, transparent to clicks now - [`18ddace`](https://github.com/microsoft/terminal/commit/18ddace401ca7827df28da326c8258e471d6c72d) the start of a bunch of actions - [`be83255`](https://github.com/microsoft/terminal/commit/be8325540b3f7aed4e5a942e68adc850b67d881b) Plumb more actions through - [`66a5d9e`](https://github.com/microsoft/terminal/commit/66a5d9e45bfc20ed97c5be50beedadbf7d17d106) Auto prompt detection on enter - [`928002b`](https://github.com/microsoft/terminal/commit/928002b7402e7726e5eebb537a5740b7fc7437e6) setting to enable scrollbar marks - [`036ebb1`](https://github.com/microsoft/terminal/commit/036ebb18fddd24ac7da6209577ef0aaeb831df27) Be able to mark a selection via the action, because that's handy! - [`958dfa3`](https://github.com/microsoft/terminal/commit/958dfa38885a845e1d34c100055404ba504743bf) howd i miuss this - [`fb0bc53`](https://github.com/microsoft/terminal/commit/fb0bc53fa0760ca1be8eeac5bef236b5fbbfa708) plumb iterm2 marks thru to the control, draw on scrollbar - [`b7a8445`](https://github.com/microsoft/terminal/commit/b7a84456bf8105f76777221d1ee7eb4e69cf9722) let the user overscroll marks to the start/end - [`df00505`](https://github.com/microsoft/terminal/commit/df005057855702b1b7ef1fe0927925d49db56cd6) clearing a selection of marks is important too ### 📊 Changes **40 files changed** (+754 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/AppActionHandlers.cpp` (+49 -0) 📝 `src/cascadia/TerminalControl/ControlCore.cpp` (+162 -0) 📝 `src/cascadia/TerminalControl/ControlCore.h` (+7 -0) 📝 `src/cascadia/TerminalControl/ControlCore.idl` (+0 -1) 📝 `src/cascadia/TerminalControl/IControlSettings.idl` (+1 -0) 📝 `src/cascadia/TerminalControl/ICoreState.idl` (+32 -0) 📝 `src/cascadia/TerminalControl/TermControl.cpp` (+72 -14) 📝 `src/cascadia/TerminalControl/TermControl.h` (+9 -0) 📝 `src/cascadia/TerminalControl/TermControl.xaml` (+24 -0) 📝 `src/cascadia/TerminalControl/pch.h` (+1 -0) 📝 `src/cascadia/TerminalCore/ICoreAppearance.idl` (+9 -0) 📝 `src/cascadia/TerminalCore/ICoreSettings.idl` (+3 -0) 📝 `src/cascadia/TerminalCore/Terminal.cpp` (+138 -1) 📝 `src/cascadia/TerminalCore/Terminal.hpp` (+15 -0) 📝 `src/cascadia/TerminalCore/TerminalApi.cpp` (+6 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionAndArgs.cpp` (+8 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.cpp` (+34 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.h` (+14 -0) 📝 `src/cascadia/TerminalSettingsModel/ActionArgs.idl` (+11 -0) 📝 `src/cascadia/TerminalSettingsModel/AllShortcutActions.h` (+6 -0) _...and 20 more files_ </details> ### 📄 Description Adds support for marks in the scrollbar. These marks can be added in 3 ways: * Via the iterm2 `OSC 1337 ; SetMark` sequence * Via the `addMark` action * Automatically when the `experimental.autoMarkPrompts` per-profile setting is enabled. #11000 has more tracking for the big-picture for this feature, as well as additional follow-ups. This set of functionality seemed complete enough to send a review for now. That issue describes these how I wish these actions to look in the fullness of time. This is simply the v0.1 from the hackathon last month. #### Actions * `addMark`: add a mark to the buffer. If there's a selection, use place the mark covering at the selection. Otherwise, place the mark on the cursor row. - `color`: a color for the scrollbar mark. This is optional - defaults to the `foreground` color of the current scheme if omitted. * `scrollToMark` - `direction`: `["first", "previous", "next", "last"]` * `clearMark`: Clears marks at the current postition (either the selection if there is one, or the cursor position. * `clearAllMarks`: Don't think this needs explanation. #### Per-profile settings * `experimental.autoMarkPrompts`: `bool`, default `false`. * `experimental.showMarksOnScrollbar`: `bool` ## PR Checklist * [x] Closes #1527 * [x] Closes #6232 ## Detailed Description of the Pull Request / Additional comments This is basically hackathon code. It's experimental! That's okay! We'll figure the rest of the design in post. Theoretically, I should make these actions `experimental.` as well, but it seemed like since the only way to see these guys was via the `experimental.showMarksOnScrollbar` setting, you've already broken yourself into experimental jail, and you know what you're doing. Things that won't work as expected: * resizing, ESPECIALLY reflowing * Clearing the buffer with ED sequences / Clear Buffer I could theoretically add velocity around this in the `TermControl` layer. Always prevent marks from being visible, ignore all the actions. Marks could still be set by VT and automark, but they'd be useless. Next up priorities: * Making this work with the FinalTerm sequences * properly speccing * adding support for `showMarksOnScrollbar: flags(categories)`, so you can only display errors on the scrollbar * adding the `category` flag to the `addMark` action ## Validation Steps Performed I like using it quite a bit. The marks can get noisy if you have them emitted on every prompt and the buffer has 9000 lines. But that's the beautiful thing, the actions work even if the marks aren't visible, so you can still scroll between prompts. <details> <summary>Settings blob</summary> ```jsonc // actions { "keys": "ctrl+up", "command": { "action": "scrollToMark", "direction": "previous" }, "name": "Previous mark" }, { "keys": "ctrl+down", "command": { "action": "scrollToMark", "direction": "next" }, "name": "Next mark" }, { "keys": "ctrl+pgup", "command": { "action": "scrollToMark", "direction": "first" }, "name": "First mark" }, { "keys": "ctrl+pgdn", "command": { "action": "scrollToMark", "direction": "last" }, "name": "Last mark" }, { "command": { "action": "addMark" } }, { "command": { "action": "addMark", "color": "#ff00ff" } }, { "command": { "action": "addMark", "color": "#0000ff" } }, { "command": { "action": "clearAllMarks" } }, // profiles.defaults "experimental.autoMarkPrompts": true, "experimental.showMarksOnScrollbar": true, ``` </details> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:34:09 +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#29307