From bf2e24c6ed00e67466c1dbf967c23eef29aaf73e Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sun, 24 Nov 2013 18:53:05 -0800 Subject: Fix indenting of item_db At some point, 'make indent' needs to be run, but that will cause merge conflicts so I'm not doing it yet. --- aligncsv.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/aligncsv.cpp b/aligncsv.cpp index 6e570e5..ef75ac0 100644 --- a/aligncsv.cpp +++ b/aligncsv.cpp @@ -7,10 +7,12 @@ #include #include -// this configuration puts 3-6 spaces between entries (excluding headers) +// this configuration puts 2-5 spaces between entries (excluding headers) // and rounds the start of each field up to 4, for easier manual indenting -const size_t min_pad = 3; +// but force each field to be at least size 8 +const size_t min_pad = 2; const size_t align_pad = 4; +const size_t min_size = 8; void add_pieces(std::vector& line, std::vector& sizes) { @@ -39,6 +41,8 @@ void add_pieces(std::vector& line, std::vector& sizes) line[i].resize(--elt_size); // mandatory padding and comma elt_size += min_pad + 1; + if (elt_size < min_size) + elt_size = min_size; if (elt_size > sizes[i]) // always true if we expanded sizes sizes[i] = elt_size; -- cgit v1.2.3-60-g2f50