Skip to content

Commit 8bea80a

Browse files
author
H. S. Teoh
committedMar 11, 2022
Fix ColsPerDay latent bugs.
1 parent 2dfa8b7 commit 8bea80a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
 

‎dcal.d

+4-3
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,9 @@ auto formatWeek(Range)(Range weeks) pure nothrow
336336
buf.put(spaces(ColsPerDay * startDay));
337337

338338
// Format each day into its own cell and append to target string.
339-
string[] days = map!((Date d) => " %2d".format(d.day))(r.front)
340-
.array;
339+
string[] days = r.front
340+
.map!((Date d) => "%*d".format(ColsPerDay, d.day))
341+
.array;
341342
assert(days.length <= 7 - startDay);
342343
days.copy(buf);
343344

@@ -418,7 +419,7 @@ auto makeWeekdaysHeader()()
418419
{
419420
auto weekdayNames = [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ];
420421
return weekdayNames
421-
.map!(s => format(" %.*s", ColsPerDay, s))
422+
.map!(s => format("%*s", ColsPerDay, s))
422423
.join();
423424
}
424425

0 commit comments

Comments
 (0)
Please sign in to comment.