-
Notifications
You must be signed in to change notification settings - Fork 167
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
Comments
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.
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?) |
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. |
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.
The text was updated successfully, but these errors were encountered: