Open greggyb opened 3 months ago
OK interesting
Yeah I suppose it is reasonable that if the error occurs on column 30, and the line is 900 characters long, then we cut off the line to 60 or 80 or 100?
That is pretty easily done and can mitigate cases like this
If the error is on column 700 out of 900, then it might still look bad
But I think the rough heuristic may still be worth it, it can improve many cases
Although in theory I suppose you could show columns 650-750, but maybe let's start with the simpler thing
I think truncating makes sense as a first step. Some additional thoughts as I'm thinking about this:
theverylonglinevar=$(aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)
^ here's your problem
&& printf "and the rest of the command line ...." |
...
When the command spills past one line, the error indicator does not point directly to the offending character of the command in question. You can see this in the image below, where the error is directly pointing to the middle of a literal string, rather than to the part of the pipeline and variable assignment that triggers this error.
Additionally, as you can see in the very long variable name, when the error occurs off of the first printed terminal line, then the error indicator also spills over the terminal width and you get empty space between the command and the indicator.
Columns do line up correctly, but the way this is indicated is not terribly readable. I expect this will mostly be an issue in anything minified or machine generated. I hope most humans aren't writing stuff like this on their own.
Running release 0.21.0 on Ubuntu 22.04.
Command is below. And 2 simpler reproductions (that also have no risk of mutating your system state (:, so perhaps more useful) is also below.
Original prompt from https://github.com/FrameworkComputer/linux-docs/blob/main/22.04-OEM-D.md
And a safer one that just prints to the terminal:
And one that pushes the error indicator another line away (with error message shown in image below):