microsoft / microsoft/terminal
Saving/restoring character attributes (and DECSCNM)?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
Description
Microsoft Windows 10 Pro for Workstations
10.0.19042.746 (2009, 20H2)
WindowsTerminalPreview_1.5.3242.0_x64
I have a VBEEP command (visual beep, plugin for TCC.EXE from JPSoft). It saves the character attributes in the viewport like this.
dwSize = con.csbi.dwSize.X * con.csbi.dwSize.Y; // terminal viewport
ReadConsoleOutputAttribute(con.h, attrs_original, dwSize, {0,0}, &dwRead); // get current attributes
Then it momentarily changes all attributes to the reverse of the default, like this.
attrs_reversed = ((con.csbi.wAttributes & 0x00F0) >> 4) | ((con.csbi.wAttributes & 0x000F) << 4);
FillConsoleOutputAttribute(con.h, attrs_reversed, dwSize, {0,0}, &dwWritten);
Then it restores the original attributes, like this.
WriteConsoleOutputAttribute(con.h, attrs_original, dwSize, {0,0}, &dwWritten); // back to original attributes
But, as I hope can be seen below, After executing VBEEP, the attributes of previously displayed text seem to have changed. Check out the display of the previous "echos ..." commands before/after the "vbeep" command; lines that were half yellow before the vbeep, are all yellow afterward.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the VBEEP reproduction on Windows Terminal 1.5.3242.0 and compare the viewport before and after the ReadConsoleOutputAttribute, FillConsoleOutputAttribute, and WriteConsoleOutputAttribute sequence. Trace how these console attribute operations affect previously displayed text; done means the original attributes remain unchanged after VBEEP runs, with the behavior verified against the supplied video scenario.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- cli, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100