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

Wrapped lines create extra linefeed #21

Closed
aleherb opened this issue Apr 28, 2014 · 2 comments
Closed

Wrapped lines create extra linefeed #21

aleherb opened this issue Apr 28, 2014 · 2 comments

Comments

@aleherb
Copy link

aleherb commented Apr 28, 2014

When sending a line which is as long as the console window width (a wrapped line) the following CR LF sequence to move the cursor to the next line is superfluous, because the terminal cursor position has implicitly moved to the next line already. This creates an extra empty line in the terminal client.

aleherb pushed a commit to aleherb/winpty that referenced this issue Apr 29, 2014
If a line fills the terminal width, the cursor moves to the next line
implicitly and there is no need to send an extra line feed.
@rprichard
Copy link
Owner

This is one of the ways the Windows console and Unix terminals differ. After writing the last character in a line, the Windows console immediately advances by a line. A Unix terminal, on the other hand, moves the cursor to the position just after the last cell in the line. Line advancement doesn't happen until the first character of the next line is output, or if a CR is output, no advancement happens at all. (This behavior allows writing to the bottom-right cell.)

This can be verified using echo. It can be helpful to write out a "DSR", where the terminal reports the cursor position as keyboard input. e.g. echo -e "xxxxxx\e[6nyyyyyy\e[6n"

The current #21 fix will work for sequential output where the CRLF is redundant. I would expect it to break if a full line were instead modified. (Successive modifications should appear to walk up the terminal.) I think the fix could be modified to let the terminal wrap in some cases, but I'm concerned about how rewrapping terminals (e.g. the OS X terminal) would handle it.

What terminal are you using to display the output of winpty? (Perhaps you're using the Windows console?)

@aleherb
Copy link
Author

aleherb commented Apr 29, 2014

I am viewing the output in the Eclipse Terminal view (which should actually behave like a Unix terminal), but I do see now that it does not handle the line wrap case in the same way as e.g. an xterm. Anyway, thanks for the hints! I'll close this bug and redirect the issue to the Eclipse Terminal view then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants