Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap the description in the zone menu to avoid a ridiculous width #76157

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/clzones.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ std::optional<std::string> zone_manager::query_name( const std::string &default_
}
}

static std::string wrap60( const std::string &text )
{
return string_join( foldstring( text, 60 ), "\n" );
}

std::optional<zone_type_id> zone_manager::query_type( bool personal ) const
{
const auto &types = get_manager().get_types();
Expand All @@ -609,13 +614,13 @@ std::optional<zone_type_id> zone_manager::query_type( bool personal ) const

uilist as_m;
as_m.desc_enabled = true;
as_m.text = _( "Select zone type:" );
as_m.title = _( "Select zone type:" );

size_t i = 0;
for( const auto &pair : types_vec ) {
const zone_type &type = pair.second;

as_m.addentry_desc( i++, true, MENU_AUTOASSIGN, type.name(), type.desc() );
as_m.addentry_desc( i++, true, MENU_AUTOASSIGN, type.name(), wrap60( type.desc() ) );
}

as_m.query();
Expand Down
6 changes: 4 additions & 2 deletions src/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ void uilist_impl::draw_controls()
parent.hovered = parent.fentries[ i ];
}
ImGui::SameLine( 0, 0 );
cataimgui::draw_colored_text( entry.hotkey.value().short_description(),
is_selected ? parent.hilight_color : parent.hotkey_color );
if( entry.hotkey.has_value() ) {
cataimgui::draw_colored_text( entry.hotkey.value().short_description(),
is_selected ? parent.hilight_color : parent.hotkey_color );
}

ImGui::TableSetColumnIndex( 1 );
nc_color color = ( is_selected ?
Expand Down
Loading