clock: make calendar padding portable across FormatStream char types

std::setfill is templated on the fill char type, which must match the
Glib::ustring FormatStream's char type. That type is wchar_t with
libstdc++/glibmm but char with libc++, so no fixed literal (' ' or L' ')
compiles everywhere. The stream's default fill is already a space, so
drop std::setfill entirely; std::setw/std::left/std::right are
char-type-agnostic and keep the exact padding behavior.
This commit is contained in:
Alex
2026-07-03 21:41:10 +02:00
parent 6e24923f6d
commit 9ac3f9b951
+6 -1
View File
@@ -402,8 +402,13 @@ auto waybar::modules::Clock::get_calendar(const year_month_day& today, const yea
data = g_utf8_find_next_char(data, end);
}
}
// Note: the stream's default fill character is already a space (L' ' on
// libstdc++'s wide FormatStream, ' ' on libc++'s narrow one), so no
// std::setfill is needed. Passing std::setfill(' ')/std::setfill(L' ')
// here is not portable because the fill char type must match the
// FormatStream's char type, which differs between standard libraries.
os << Glib::ustring::format(
(cldWPos_ != WS::LEFT || line == 0) ? std::left : std::right, std::setfill(' '),
(cldWPos_ != WS::LEFT || line == 0) ? std::left : std::right,
std::setw(cldMonColLen_ + ((line < 2) ? cldWnLen_ - wideCharCount : 0)),
calendarLine);