Skip to content

ENABLE_WRAP_AT_EOL_OUTPUT is not working with VT100 #349

Description

@Maxim-Kornilov

The cursor doesn't moves to the beginning of the next row when it reaches the end of the current row. It works as intended when VT100 is disabled.

Windows build number: Microsoft Windows [Version 10.0.17134.523]

Code:

#include <iostream>
#include <string>
#include <Windows.h>

using std::string;
using std::cout;
using std::endl;

int main()
{
    HANDLE stdOut = GetStdHandle(STD_OUTPUT_HANDLE);

    DWORD consoleMode =
        ENABLE_PROCESSED_OUTPUT |
        ENABLE_WRAP_AT_EOL_OUTPUT |
        ENABLE_VIRTUAL_TERMINAL_PROCESSING;

    SetConsoleMode(stdOut, consoleMode);

    CONSOLE_SCREEN_BUFFER_INFO screenBufferInfo;
    GetConsoleScreenBufferInfo(stdOut, &screenBufferInfo);

    SHORT length = screenBufferInfo.dwSize.X;
    string str(length - 1, '.');
    cout << str;

    int before = 0;
    int after = 0;

    GetConsoleScreenBufferInfo(stdOut, &screenBufferInfo);
    before = screenBufferInfo.dwCursorPosition.X;

    cout << 'x';

    GetConsoleScreenBufferInfo(stdOut, &screenBufferInfo);
    after = screenBufferInfo.dwCursorPosition.X;

    cout << endl
        << "before: " << before << endl
        << "after: " << after << endl;
}

Output:

before: 119
after: 119

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-OutputRelated to output processing (inserting text into buffer, retrieving buffer text, etc.)Issue-BugIt either shouldn't be doing this or needs an investigation.Product-ConhostFor issues in the Console codebase

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions