Skip to content

Commit

Permalink
remove the item spacing in category titles so the ascii art looks right
Browse files Browse the repository at this point in the history
  • Loading branch information
db48x committed Dec 15, 2024
1 parent e89090a commit d04e24b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ std::string help_window::get_dir_grid()

void help_window::note_colors()
{
ImGui::Text( _( "Note colors: " ) );
ImGui::TextUnformatted( _( "Note colors: " ) );
ImGui::SameLine( 0.f, 0.f );
for( const auto &color_pair : get_note_color_names() ) {
// The color index is not translatable, but the name is.
Expand Down Expand Up @@ -209,27 +209,28 @@ void help_window::format_title( const std::string translated_category_name )
}
const float title_length = ImGui::CalcTextSize( remove_color_tags(
translated_category_name ).c_str() ).x;
ImGui::PushStyleVarY( ImGuiStyleVar_ItemSpacing, 0 );
cataimgui::PushMonoFont();
const int sep_len = std::ceil( ( title_length / ImGui::CalcTextSize( "" ).x ) + 2 );
ImGui::PushStyleColor( ImGuiCol_Text, c_light_blue );

ImGui::Text( "" );
ImGui::SameLine( 0.f, 0.f );
for( int i = sep_len; i > 0; i-- ) {
ImGui::Text( "" );
ImGui::SameLine( 0.f, 0.f );
}
int x = ImGui::GetCursorPosX();
ImGui::Text( "" );
// Using the matching box character doesn't look good bc there's forced(?) y spacing on NewLine
ImGui::Text( "" );
ImGui::Text( "" );
ImGui::SameLine( 0.f, 0.f );
ImGui::PopStyleColor();
ImGui::PopFont();
cataimgui::TextColoredParagraph( c_white, translated_category_name );
cataimgui::PushMonoFont();
ImGui::SameLine( 0.f, 0.f );
ImGui::PushStyleColor( ImGuiCol_Text, c_light_blue );
ImGui::Text( "" );
ImGui::SetCursorPosX( x );
ImGui::Text( "" );
ImGui::Text( "" );
ImGui::SameLine( 0.f, 0.f );
for( int i = sep_len; i > 0; i-- ) {
Expand All @@ -239,6 +240,8 @@ void help_window::format_title( const std::string translated_category_name )
ImGui::Text( "" );
ImGui::PopStyleColor();
ImGui::PopFont();
ImGui::PopStyleVar();

ImGui::NewLine();
ImGui::PushStyleColor( ImGuiCol_Separator, c_light_blue );
ImGui::Separator();
Expand Down

0 comments on commit d04e24b

Please sign in to comment.