-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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 lead to wrong problems #32042
Comments
It looks like the terminal task runner isn't getting unwrapped lines on windows - I think this is essentially what the discussion at #29840 (comment) is about. |
Pretty sure this is not a regression and applies to all platforms. |
@Tyriar from your comment here #29840 (comment) I expected to get unwrapped lines. If I still get wrapped lines can we tackle this using the workaround I proposed in #29840 (comment) |
@Tyriar FYI the problem was not reproducible on macOS. |
@Tyriar I tested this under Windows and I still get the wrapped lines with the latest insider build. Executing a task in the terminal in cmd.exe produces this in the terminal: and captures this problem Is there anything I can do to workaround this. |
Not that I'm aware of, we get the data from winpty pre-wrapped. |
Unhappy :-( Would this need the view model discussed in #29840 |
I think it's just a limitation of how winpty works; it will try wrap the content based on the width of the terminal. I think there is some other issue that was discussing how PowerShell formats things in these tables but then wraps text in the table cells, this is similar to that. |
I disagree. Also both wrap, in PowerShell I can control whether the output is a table or not. If I use the output table style in PowerShell I expect it to be wrapped (I asked for it). For me this is comparable to asking the editor for a line and the editor returns me the wrapped content. As a user of that API it makes it almost impossible to program against this. Would it be possible to somehow |
@dbaeumer as I mentioned in #26807 (comment), i'll be busy through September but I'm going to be making this a priority in the October iteration. |
@rprichard I just looked into this a bit and came across rprichard/winpty#21, I think that's describing the same issue that we're having. xterm.js supports wraparound mode (DECAWM) and expects that single lines do not wrap themselves. Since xterm.js wraps the lines itself, it knows what the full unwrapped line is which can enable integrations like above. To be clear, xterm.js expects no special characters between lines when they wraps in order for wraparound mode to work, not Here is the code in xterm.js that handles wrapping: |
winpty gets console buffer data from |
@rprichard thanks for the explanation. Now that I know how that works we might need to approach this differently since 'unwrapping' these lines in winpty might do wrong things and lead to false positives. I would propose that the terminal in VS Code in some way gives me access to the 'rendered' lines and the current wrapping column. Then the problem matcher could do the following algorithm (not fully thought through though):
|
@dbaeumer I tried to do something like your proposed workaround yesterday and it kind of worked. I may have done something wrong though. I'll go ahead with something like this at the xterm.js level when I free up 👍 Here are the relevant bits of code:
|
@Tyriar thanks for looking into this. Let me know when there is API I can start to use and I will try to implement the proposal in the problem matcher. |
@Tyriar any news on this. I there new API I could use to implement the algorithm I outlined here: #32042 (comment) |
@Tyriar I looked at the new line data listener and it looks promising. However there is one thing I would like to see add to make it work nicely. The listener should fire with the last line when the process terminates. This ensures that no data is lost even if the last line doesn't end with a CR |
@Tyriar just to be sure that I understand Assuming it is I would need an additional API to read the width of the terminal to implement the proposal from here: #32042 (comment) Could you add this? |
@dbaeumer for a line that is wrapped into three lines, I'm guessing (hoping) you're testing this on Windows as it doesn't work there yet until this issue is closed. I have a work in progress on https://github.com/Tyriar/xterm.js/tree/winptyCompat for working around the wrapped line problem on Windows which should make it act more like macOS/Linux. You can test your |
@Tyriar great. That will make my live easier and yes I was testing this on Windows recognizing the new API today. Can you also comment on the request to send the last line when the process terminates? |
@dbaeumer yeah that makes a lot of sense to do that, working on it now |
@dbaeumer done, let me know if you find any issues with it. |
This should work in the next Insiders when you're using the new |
@Tyriar Thanks ! |
The windows smoke test fails on https://github.com/Microsoft/vscode/blob/master/test/smoke/src/tests/tasks.ts#L51.
The reason for this is that the terminal is wrapping the error message and the problem matcher only picks up the wrapped part of the line:
The text was updated successfully, but these errors were encountered: