aboutsummaryrefslogtreecommitdiff
path: root/src/line_accumulator.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/line_accumulator.cc')
-rw-r--r--src/line_accumulator.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/line_accumulator.cc b/src/line_accumulator.cc
index d12ef54..31b8ddc 100644
--- a/src/line_accumulator.cc
+++ b/src/line_accumulator.cc
@@ -54,8 +54,12 @@ std::size_t getCharacterLength(const std::string& token) {
namespace justify {
-LineAccumulator::LineAccumulator(const std::uint8_t max_length):
+LineAccumulator::LineAccumulator(
+ const std::uint8_t max_length,
+ const std::uint8_t offset
+):
max_length_{max_length},
+ offset_{offset},
length_{0},
tokens_{} { }
@@ -160,6 +164,10 @@ void LineAccumulator::discharge(const bool full) {
this->justify();
}
+ if ( this->offset_ > 0 ) {
+ std::cout << std::string(this->offset_, ' ');
+ }
+
for ( const auto& token : this->tokens_ ) {
std::cout << token.first
<< std::string(token.second, ' ');