Fix "help" command output format.
It should keep output to the same line until TerminalWidth is reached.
Details
- Reviewers
lldb-commits tfiala zturner jingham clayborg
Diff Detail
Event Timeline
Yes, your version clearly has the test right. I was wondering why this didn't have a more dramatic ill-effect, but it turns out that this function is only used for printing argument help text, which it clearly messes up:
(lldb) help format <format> -- One of the format names (or one-character names)
I'm not sure why we need a separate function for printing argument output that does wrapping differently from command help, but that's a question for another day.
It doesn't look like there are any tests for this help output. But it should be possible to write a test for this. You can get what you need programmatically, e.g.:
>>> result = lldb.SBCommandReturnObject() >>> lldb.debugger.GetCommandInterpreter().HandleCommand("help format", result) 1 >>> print result.GetOutput() <format> -- One of the format names (or one-character names) that can be used to show a variable's value: "default" 'B' or "boolean" 'b' or "binary" 'y' or "bytes" 'Y' or "bytes with ASCII"
And you can get & set the terminal width of the debugger with the SBDebugger.{Get,Set}TerminalWidth, so you could make sure that the length of line 1 + length of first word on line 2 > terminal width. The only tricky bit would be picking the right command to use.
This is such an obvious fix it seems unkind to stall it for a test, but OTOH, if you could whip one up that would be great!
BTW, the second listing was after applying your patch, showing it clearly does the right thing...