#include "status_manager.hpp" #include #include #include void StatusManager::bind(const std::shared_ptr &statusline) noexcept { _statusline = statusline; } void StatusManager::set_section_title( const StatusLineSection §ion, const std::string_view &title) { if (_section_title_lengths.contains(section)) { throw std::logic_error(fmt::format( "Unable to set statusbar section title to '{}'. Section has already been " "assigned a title", title)); } _statusline->set_section_status(section, title); _section_title_lengths[section] = static_cast(title.length()); } void StatusManager::set_section_body( const StatusLineSection §ion, const std::string_view &body) noexcept { auto section_title_length = _section_title_lengths[section]; _statusline->set_section_status(section, body, section_title_length + 1); }