Skip to content

WriteCharsLegacy: Accumulated bugs #10808

@DHowett

Description

@DHowett

Inserting a tab character that would put us at the right edge of the buffer inserts two tabs (one to get us to the right edge of the buffer, one more after we wrap)

Code and example
#include <windows.h>
int main() {
        CONSOLE_SCREEN_BUFFER_INFOEX csbiex{};
        csbiex.cbSize = sizeof(csbiex);
        GetConsoleScreenBufferInfoEx(GetStdHandle(STD_OUTPUT_HANDLE), &csbiex);
        SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), COORD{(SHORT)(csbiex.dwSize.X - 9), csbiex.dwCursorPosition.Y});
        WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), L"|\t|\n", 4, nullptr, nullptr);
        return 0;
}

image

Inserting a printable control character at the right edge of the screen (ala ^A) when only the ^ would fit emits a ^ and a space.

Example

image
(here, ^D)

Inserting a printable control character (^D) at the right edge of the screen when both ^ and D fit and then backspacing it deletes the ^, not the D:

Example

image

Metadata

Metadata

Labels

Area-OutputRelated to output processing (inserting text into buffer, retrieving buffer text, etc.)Impact-CorrectnessIt be wrong.In-PRThis issue has a related PRIssue-BugIt either shouldn't be doing this or needs an investigation.Product-ConhostFor issues in the Console codebase

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions