Skip to content

Commit

Permalink
help: Prevent line breaks within the "Required XP: 80" block by using…
Browse files Browse the repository at this point in the history
… non-breaking spaces.
  • Loading branch information
jostephd committed Oct 19, 2018
1 parent fc2c0e7 commit 72daec4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/font/constants.cpp
Expand Up @@ -33,6 +33,7 @@ const std::size_t max_text_line_width = 4096;

const std::string
ellipsis = "...",
nbsp = " ", // non-breaking space; unicode u00a0

unicode_minus = "-",
unicode_en_dash = "", // unicode u2013
Expand Down
1 change: 1 addition & 0 deletions src/font/constants.hpp
Expand Up @@ -37,6 +37,7 @@ extern const std::size_t max_text_line_width;
// String constants
extern const std::string
ellipsis,
nbsp,

unicode_minus,
unicode_en_dash,
Expand Down
17 changes: 10 additions & 7 deletions src/help/help_topic_generators.cpp
Expand Up @@ -505,20 +505,23 @@ std::string unit_topic_generator::operator()() const {

// Print some basic information such as HP and movement points.
// TODO: Make this info update according to musthave traits, similar to movetype below.
ss << _("HP: ") << type_.hitpoints() << jump(30)
<< _("Moves: ") << type_.movement() << jump(30);
ss << _("HP:") << font::nbsp << type_.hitpoints() << jump(30)
<< _("Moves:") << font::nbsp << type_.movement() << jump(30);
if (type_.vision() != type_.movement()) {
ss << _("Vision: ") << type_.vision() << jump(30);
ss << _("Vision:") << font::nbsp << type_.vision() << jump(30);
}
if (type_.jamming() > 0) {
ss << _("Jamming: ") << type_.jamming() << jump(30);
ss << _("Jamming:") << font::nbsp << type_.jamming() << jump(30);
}
ss << _("Cost: ") << type_.cost() << jump(30)
<< _("Alignment: ")
ss << _("Cost:") << font::nbsp << type_.cost() << jump(30)
<< _("Alignment:") << font::nbsp
<< make_link(type_.alignment_description(type_.alignment(), type_.genders().front()), "time_of_day")
<< jump(30);
if (type_.can_advance()) {
ss << _("Required XP: ") << type_.experience_needed();
// TRANSLATORS: This string is used in the help page of a single unit. It uses
// non-breaking spaces to prevent unpleasant line breaks (issue #3256). In the
// translation use non-breaking spaces as appropriate for the target language.
ss << _("Required\u00a0XP:") << font::nbsp << type_.experience_needed();
}

// Print the detailed description about the unit.
Expand Down

0 comments on commit 72daec4

Please sign in to comment.