Optimization in the formatting of string values
This commit is contained in:
parent
2d58224001
commit
7a44791221
2 changed files with 9 additions and 3 deletions
|
|
@ -355,8 +355,11 @@ string format_t::real_calc(scope_t& scope)
|
|||
}
|
||||
DEBUG("format.expr", "value = (" << value << ")");
|
||||
|
||||
value.print(out, static_cast<int>(elem->min_width), -1,
|
||||
! elem->has_flags(ELEMENT_ALIGN_LEFT));
|
||||
if (elem->min_width > 0)
|
||||
value.print(out, static_cast<int>(elem->min_width), -1,
|
||||
! elem->has_flags(ELEMENT_ALIGN_LEFT));
|
||||
else
|
||||
out << value.to_string();
|
||||
}
|
||||
catch (const calc_error&) {
|
||||
add_error_context(_("While calculating format expression:"));
|
||||
|
|
|
|||
|
|
@ -1618,7 +1618,10 @@ void value_t::print(std::ostream& out,
|
|||
break;
|
||||
|
||||
case STRING:
|
||||
justify(out, as_string(), first_width, right_justify);
|
||||
if (first_width > 0)
|
||||
justify(out, as_string(), first_width, right_justify);
|
||||
else
|
||||
out << as_string();
|
||||
break;
|
||||
|
||||
case MASK:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue