Skip to content

Commit

Permalink
Merge pull request #75696 from db48x/uilist-mixed-hotkeys
Browse files Browse the repository at this point in the history
Keep uilist menu items lined up with each other even if some do not have hotkeys
  • Loading branch information
Maleclypse authored Aug 15, 2024
2 parents a82f380 + d793a3e commit c72f9ef
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ void uilist_impl::on_resized()

void uilist_impl::draw_controls()
{
float hotkey_width =
ImGui::CalcTextSize( "[X]" ).x + ImGui::GetStyle().ItemSpacing.x;

if( !parent.text.empty() ) {
cataimgui::draw_colored_text( parent.text );
ImGui::Separator();
Expand Down Expand Up @@ -108,6 +111,8 @@ void uilist_impl::draw_controls()
ImGui::SameLine( 0, 0 );
ImGui::Text( "%c", ']' );
ImGui::SameLine();
} else {
ImGui::SetCursorPosX( hotkey_width );
}
nc_color color = ( is_selected ?
parent.hilight_color :
Expand Down

0 comments on commit c72f9ef

Please sign in to comment.