Repository navigation
Turn on line wrapping in usage and status messages, adds ANSI color to doctor and analysis messages. - #22656
Conversation
bc80da0 to
0136b41
Compare
0136b41 to
6f09f0e
Compare
|
One thing to think about for the review: Would it be better to just do no wrapping at all if not outputting to a terminal? Right now it wraps at 100 chars in that case. |
There was a problem hiding this comment.
I think we can add a test for this one too.
There was a problem hiding this comment.
Document the params in the dartdoc
There was a problem hiding this comment.
dartdocs for these. I couldn't figure out what they are from name.
There was a problem hiding this comment.
No, I want to remove them all, since the next line adds a reset that would cancel them all, or be redundant anyhow.
There was a problem hiding this comment.
I meant swapping *m to +m. I assume you want 1 or more rather than 0 or more.
There was a problem hiding this comment.
Oh, I see. Yeah, definitely, although it's probably moot, since ^[[m isn't a valid ANSI escape (or commonly typed sequence!). Done.
There was a problem hiding this comment.
Maybe describe a bit what issues this solves? Since there are some risks associated with the regex
There was a problem hiding this comment.
Why is the above public and this is not? Seems like they should be known to the user to the same extent.
There was a problem hiding this comment.
Yeah, I guess so. It kind of seemed like an implementation detail, but I suppose you might want to know it to take it into account somewhere. Done.
There was a problem hiding this comment.
Just make it clear about whether it's in addition or instead of indent.
There was a problem hiding this comment.
Good point. Done.
There was a problem hiding this comment.
Why not the same with hangingIndent?
There was a problem hiding this comment.
Because I forgot to add it when I added hangingIndent. Fixed.
bbb8b57 to
5cf50c3
Compare
|
Still LGTM |
5cf50c3 to
37944e2
Compare
… color to doctor and analysis messages. (flutter#22656)" This reverts commit e438632 because it breaks 160 benchmarks, and several devicelab tests, due to changing the format of the output.
…color to doctor and analysis messages. (flutter#22656) This turns on text wrapping for usage messages and status messages. When on a terminal, wraps to the width of the terminal. When writing to a non-terminal, wrap lines at a default column width (currently defined to be 100 chars). If --no-wrap is specified, then no wrapping occurs. If --wrap-column is specified, wraps to that column (if --wrap is on). Adds ANSI color to the doctor and analysis output on terminals. This is in this PR with the wrapping, since wrapping needs to know how to count visible characters in the presence of ANSI sequences. (This is just one more step towards re-implementing all of Curses for Flutter. :-)) Will not print ANSI sequences when sent to a non-terminal, or of --no-color is specified. Fixes ANSI color and bold sequences so that they can be combined (bold, colored text), and a small bug in indentation calculation for wrapping. Since wrapping is now turned on, also removed many redundant '\n's in the code.
This attempts to re-land #22656. There are two changes from the original: I turned off wrapping completely when not sending output to a terminal. Previously I had defaulted to wrapping at and arbitrary 100 chars in that case, just to keep long messages from being too long, but that turns out the be a bad idea because there are tests that are relying on the specific form of the output. It's also pretty arbitrary, and mostly people sending output to a non-terminal will want unwrapped text. I found a better way to terminate ANSI color/bold sequences, so that they can be embedded within each other without needed quite as complex a dance with removing redundant sequences. As part of these changes, I removed the Logger.supportsColor setter so that the one source of truth for color support is in AnsiTerminal.supportsColor. * Turn on line wrapping again in usage and status messages, adds ANSI color to doctor and analysis messages. (#22656) This turns on text wrapping for usage messages and status messages. When on a terminal, wraps to the width of the terminal. When writing to a non-terminal, wrap lines at a default column width (currently defined to be 100 chars). If --no-wrap is specified, then no wrapping occurs. If --wrap-column is specified, wraps to that column (if --wrap is on). Adds ANSI color to the doctor and analysis output on terminals. This is in this PR with the wrapping, since wrapping needs to know how to count visible characters in the presence of ANSI sequences. (This is just one more step towards re-implementing all of Curses for Flutter. :-)) Will not print ANSI sequences when sent to a non-terminal, or of --no-color is specified. Fixes ANSI color and bold sequences so that they can be combined (bold, colored text), and a small bug in indentation calculation for wrapping. Since wrapping is now turned on, also removed many redundant '\n's in the code.
|
Can we disable this when printing command lines in verbose mode? The line breaks mean I can no longer just copy and paste the command, and the commands I'm interested in running manually are usually very long and tedious to fix up. |
|
I'm not sure which "command lines" you're referring to, but you can always add |
|
I mean the "executing: long/path/gen_snapshot --many --options" etc. |
This turns on text wrapping for usage messages and status messages. When on a terminal, wraps to the width of the terminal. When writing to a non-terminal, wrap lines at a default column width (currently defined to be 100 chars). If --no-wrap is specified, then no wrapping occurs. If --wrap-column is specified, wraps to that column (if --wrap is on).
Adds ANSI color to the doctor and analysis output on terminals. This is in this PR with the wrapping, since wrapping needs to know how to count visible characters in the presence of ANSI sequences. (This is just one more step towards re-implementing all of Curses for Flutter. :-)) Will not print ANSI sequences when sent to a non-terminal, or of --no-color is specified.
Fixes ANSI color and bold sequences so that they can be combined (bold, colored text), and a small bug in indentation calculation for wrapping.
Since wrapping is now turned on, also removed many redundant '\n's in the code.
Some examples of how things look now (in a narrow terminal):
flutter analyze:flutter doctor -v: