diff --git a/src/item_action.cpp b/src/item_action.cpp index 9f467f9e04a7a..35b715077e286 100644 --- a/src/item_action.cpp +++ b/src/item_action.cpp @@ -339,27 +339,20 @@ void game::item_action_menu( item_location loc ) auto iter = menu_items.begin(); std::advance( iter, iactions.size() ); sort_menu( iter, menu_items.end() ); - // Determine max lengths, to print the menu nicely. - std::pair max_len; - for( const auto &elem : menu_items ) { - max_len.first = std::max( max_len.first, utf8_width( std::get<1>( elem ), true ) ); - max_len.second = std::max( max_len.second, utf8_width( std::get<2>( elem ), true ) ); - } // Fill the menu. for( const auto &elem : menu_items ) { std::string ss; ss += std::get<1>( elem ); - ss += std::string( max_len.first - utf8_width( std::get<1>( elem ), true ), ' ' ); - ss += std::string( 4, ' ' ); - ss += std::get<2>( elem ); - ss += std::string( max_len.second - utf8_width( std::get<2>( elem ), true ), ' ' ); + std::string ss_ctxt; + ss_ctxt += std::get<2>( elem ); const std::optional bind = key_bound_to( ctxt, std::get<0>( elem ) ); const bool enabled = assigned_action( std::get<0>( elem ) ); const std::string desc = std::get<3>( elem ) ; kmenu.addentry_desc( num, enabled, bind, ss, desc ); + kmenu.entries[num].ctxt = ss_ctxt; num++; }