Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update console-virtual-terminal-sequences.md with Cursor Shape #261

Merged
merged 5 commits into from
May 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion docs/console-virtual-terminal-sequences.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ The following terminal sequences are intercepted by the console host when writte
## <span id="Simple_Cursor_Positioning"></span><span id="simple_cursor_positioning"></span><span id="SIMPLE_CURSOR_POSITIONING"></span>Simple Cursor Positioning


In all of the following descriptions, ESC is always the hexadecimal value 0x1B. No spaces are to be included in terminal sequences. For an example of how these sequences are used in practice, please see the [example](#example) at the end of this topic.
In all of the following descriptions, ESC is always the hexadecimal value 0x1B. No spaces are to be included in terminal sequences. Individual terminal sequences can be split, at any character or byte position, across multiple sequential calls to [**WriteFile**](/windows/win32/api/fileapi/nf-fileapi-writefile) or [**WriteConsole**](writeconsole.md) but it is best practice to include the whole sequence in one call. For an example of how these sequences are used in practice, please see the [example](#example) at the end of this topic.

The following table describes simple escape sequences with a single action command directly after the ESC character. These sequences have no parameters and take effect immediately.

Expand Down Expand Up @@ -107,6 +107,25 @@ The following commands control the visibility of the cursor and its blinking sta
> [!TIP]
> The enable sequences end in a lowercase H character (`h`) and the disable sequences end in a lowercase L character (`l`).

## <span id="Cursor_Shape"></span><span id="cursor_shape"></span><span id="CURSOR_SHAPE"></span>Cursor Shape


The following commands control and allow for customization of the cursor shape.


| Sequence | Code | Description | Behavior |
|---------------|---------|------------------------------|---------------------------|
| ESC \[ 0 SP q | DECSCUSR | User Shape | Default cursor shape configured by the user |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elsewhere on this page, the Description column shows how the control sequence is defined by the industry, and the Behavior column shows how Windows Terminal implements it. Did DEC define DECSCUSR with parameter 0 as activating the cursor shape preferred by the user, or is that specific to Windows Terminal?

Page 5-127 of http://boundlessterminals.com/manuals/VT520-VT525ProgrammerInformation.pdf lists "0, 1 or none" as selecting the "Blink Block (Default)" cursor style. That suggests to me that the number 1 means this style specifically, and 0 or none means the default style, which in those DEC terminals is hardcoded rather than a user preference. So the pull request looks OK in that respect.

Does Windows Terminal support DECSCUSR without a parameter? Perhaps that too should be documented here, something like the paragraph in another section of this page:

For each of the sequences, the default value for &lt;n&gt; if it is omitted is 0.

| ESC \[ 1 SP q | DECSCUSR | Blinking Block | Blinking block cursor shape |
| ESC \[ 2 SP q | DECSCUSR | Steady Block | Steady block cursor shape |
| ESC \[ 3 SP q | DECSCUSR | Blinking Underline | Blinking underline cursor shape |
| ESC \[ 4 SP q | DECSCUSR | Steady Underline | Steady underline cursor shape |
| ESC \[ 5 SP q | DECSCUSR | Blinking Bar | Blinking bar cursor shape |
| ESC \[ 6 SP q | DECSCUSR | Steady Bar | Steady bar cursor shape |

> [!NOTE]
> `SP` is a literal space character (0x20) in the intermediate position, and it is followed by `q` (0x71) in the final position.

## <span id="Viewport_Positioning"></span><span id="viewport_positioning"></span><span id="VIEWPORT_POSITIONING"></span>Viewport Positioning


Expand Down