Skip to content

Commit 899d064

Browse files
committed
formatter output changes
1 parent 9a8a84a commit 899d064

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/formatter/formatter_core.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,13 +287,19 @@ std::string generate_full_text_report(
287287
for (const auto& [name, itinerary] : itineraries) {
288288
if (itinerary.items.empty()) continue;
289289

290+
size_t max_activity_width = 0;
291+
for (const auto& item : itinerary.items) {
292+
max_activity_width = std::max(max_activity_width, item.activity.length());
293+
}
294+
290295
std::string tz_string = std::string("UTC") + (itinerary.tz_offset >= 0 ? "+" : "") + std::to_string(itinerary.tz_offset);
291296
f << "\nSchedule for " << name << " (" << tz_string << "):\n";
292297

293298
for (const auto& item : itinerary.items) {
294299
double dur = item.end_local.diff_seconds(item.start_local);
295300
f << " " << item.start_local.to_string() << " to " << item.end_local.time_string()
296-
<< " (" << DateTime::format_duration((long long)dur) << "): " << item.activity << "\n";
301+
<< " " << std::left << std::setw(max_activity_width) << item.activity
302+
<< " (" << DateTime::format_duration((long long)dur) << ")\n";
297303
}
298304
}
299305
return f.str();

src/utils/date_utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace jres {
129129

130130
if (parts.empty()) return "";
131131

132-
std::string result = "for ";
132+
std::string result = "";
133133
if (parts.size() == 1) {
134134
result += parts[0];
135135
} else {

0 commit comments

Comments
 (0)