From db6edcd473a684420e9a7611b24462df21165c1b Mon Sep 17 00:00:00 2001 From: HampusM Date: Sun, 24 Apr 2022 17:13:52 +0200 Subject: style: improve function and brace styling --- src/game/statusline.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/game/statusline.cpp') diff --git a/src/game/statusline.cpp b/src/game/statusline.cpp index 6becb38..d764d60 100644 --- a/src/game/statusline.cpp +++ b/src/game/statusline.cpp @@ -7,8 +7,10 @@ #include #include -StatusLine::StatusLine(std::shared_ptr cursor_controller, - std::shared_ptr window) noexcept +StatusLine::StatusLine( + std::shared_ptr cursor_controller, + std::shared_ptr window +) noexcept : _cursor_controller(std::move(cursor_controller)), _window(std::move(window)) { constexpr uint32_t SECTION_A_LENGTH = 20; @@ -30,8 +32,10 @@ void StatusLine::initialize_background() noexcept _move_back(previous_position); } -void StatusLine::set_status(StatusLineSection section, - const std::string_view &str) noexcept +void StatusLine::set_status( + StatusLineSection section, + const std::string_view &statusline_str +) noexcept { _clear_section(section); @@ -43,7 +47,9 @@ void StatusLine::set_status(StatusLineSection section, auto section_length = _sections_lengths[section]; - auto status = str.length() > section_length ? str.substr(0, section_length) : str; + auto status = statusline_str.length() > section_length + ? statusline_str.substr(0, section_length) + : statusline_str; fmt::print("{}{}", background_color, status); fmt::print(RESET_ALL_MODES, fmt::arg("esc", ESC)); @@ -61,7 +67,7 @@ auto StatusLine::_move_to_statusline(int32_t x) noexcept -> Vector2 auto window_height = static_cast(window_size.get_height()); - _cursor_controller->move_to(Vector2({.x = x, .y = window_height}), true); + _cursor_controller->move_to(Vector2({ .x = x, .y = window_height }), true); return previous_position; } @@ -80,8 +86,9 @@ auto StatusLine::_get_section_start_x(StatusLineSection section) const noexcept while (section_index > 0) { - section_start += static_cast( - _sections_lengths.at(StatusLineSection(section_index - 1))); + section_start += + static_cast(_sections_lengths.at(StatusLineSection(section_index - 1) + )); section_index--; } -- cgit v1.2.3-18-g5258