Skip to content

Cursor position is lost when resizing the window if not on the bottom line #10848

@daanx

Description

@daanx

Windows Terminal version (or Windows build number)

10.0.19042.1110 (windows terminal 1.9.1942.0)

Other Software

No response

Steps to reproduce

If the cursor position is not on the last line (of the input), making the screen more narrow will push the cursor down to the last line when lines wrap and the original position is lost; on a resize to make it wider again it stays on the last line.

This affects utilities like "readline" when editing multiple lines of input. Hope it can be fixed as it makes multiline editing not work at all.

To reproduce, run the following batch file:

@echo off
echo Resize the window to make it more narrow and wider again.
echo The cursor will lose its position and move down.
echo.
echo The cursor is first positioned at the start of this �[33mlong�[0m line.
set /p "ANSWER=Press <enter> to stop ..�[1F"
echo.
echo Thank you.

(note: I think the paste lost it but there should be an ESC character in front of the [ characters to make the escape sequence function; the ESC[1F moves the cursor one up so it is no longer on the last line.)

Expected Behavior

The cursor should always stay at the same point in the input regardless of a window resize. The "old" cmd terminal is correct and the cursor stays at the same point..

Actual Behavior

cursor-bug-cmd

Here you see the cursor in Windows Terminal (I made it red) move down a line on the resize and lose its position.

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.Needs-Author-FeedbackThe original author of the issue/PR needs to come back and respond to somethingNeeds-TriageIt's a new issue that the core contributor team needs to triage at the next triage meetingNo-Recent-ActivityThis issue/PR is going stale and may be auto-closed without further activity.Priority-2A description (P2)Product-TerminalThe new Windows Terminal.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions