Opened 15 years ago
Closed 13 years ago
#1527 closed Bugs (fixed)
[program_options] Second (and subsequent) lines in tabbed text not aligned correctly
Reported by: | anonymous | Owned by: | Vladimir Prus |
---|---|---|---|
Milestone: | Boost 1.42.0 | Component: | program_options |
Version: | Boost 1.41.0 | Severity: | Cosmetic |
Keywords: | wrapping wrap | Cc: |
Description
When using the tab character to set an alignment for text output, the second (and subsequent) lines are not displayed at the correct position.
It appears that the number of characters between the newline (\n) and tab (\t) are not accounted for.
Example:
boost::program_options::options_description options("Options"); options.add_options() ("help", "help text") ("list", "a list:\n \t" "item1, item2, item3, item4, item5, item6, item7, item8, item9, " "item10, item11, item12, item13, item14, item15, item16, item17, item18") ; std::cout << options << std::endl;
Attachments (3)
Change History (10)
by , 13 years ago
Attachment: | ticket1527.patch added |
---|
comment:1 by , 13 years ago
I cannot reproduce this with current trunk. I think the behaviour is correct. I get following output of the mentioned testcase:
--list arg a list: item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18
I attached an enhancement for the test cases which checks the user case.
Please comment. Thanks.
comment:2 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 13 years ago
Sascha, I have applied the patch, thanks!
BTW, was there a specific reason you changed std::string to just string in a couple of places? Not that it matters much.
comment:4 by , 13 years ago
The source already had a "using namespace std;" and at some places were string's defined without "std::". So, I just wanted the source consistent without any redundancy.
Thanks, Sascha
comment:5 by , 13 years ago
Milestone: | Boost 1.36.0 → Boost 1.42.0 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Version: | Boost 1.34.1 → Boost 1.41.0 |
Hi Volodya,
The original issue is valid and still present.
The responding poster has not actually copied the OP's code exactly.
There should be six spaces between the newline (\n) and tab (\t). The patched test code only uses two. This affects the spacing enough to make it output correctly.
Find attached a patch for the test file (as it appears on the trunk), which does cause the failure, and also a patch with the fix, which is a simple one-liner.
comment:6 by , 13 years ago
Hi,
I just checked in the patch on trunk. It looks ok for me. I leave the Ticket open until Volodya reviewed it.
Sorry for confusion!
Thanks,
- Sascha
comment:7 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Seems ok to me. I'm closing this issue. Thanks for the followup, Chard!
testcase