Correctly align amounts formatted as "%12(amount)"
This commit is contained in:
parent
6e582a8777
commit
e8f315f00d
2 changed files with 37 additions and 1 deletions
|
|
@ -345,7 +345,8 @@ void format_t::format(std::ostream& out_str, scope_t& scope)
|
|||
}
|
||||
DEBUG("format.expr", "value = (" << value << ")");
|
||||
|
||||
value.print(out, elem->min_width);
|
||||
value.print(out, elem->min_width, -1,
|
||||
! elem->has_flags(ELEMENT_ALIGN_LEFT));
|
||||
}
|
||||
catch (const calc_error&) {
|
||||
add_error_context(_("While calculating format expression:"));
|
||||
|
|
|
|||
35
test/regress/F559EC12.test
Normal file
35
test/regress/F559EC12.test
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
format "%-12(scrub(amount))"
|
||||
<<<
|
||||
>>>1
|
||||
--- Context is first posting of the following transaction ---
|
||||
2004/05/27 Book Store
|
||||
Expenses:Books 20 BOOK @ $10
|
||||
Liabilities:MasterCard $-200.00
|
||||
|
||||
--- Input format string ---
|
||||
%-12(scrub(amount))
|
||||
|
||||
--- Format elements ---
|
||||
Element: EXPR flags: 0x1 min: 12 max: 0 expr: scrub(amount)
|
||||
|
||||
--- Formatted string ---
|
||||
"20 BOOK "
|
||||
>>>2
|
||||
=== 0
|
||||
format "%12(scrub(amount))"
|
||||
>>>1
|
||||
--- Context is first posting of the following transaction ---
|
||||
2004/05/27 Book Store
|
||||
Expenses:Books 20 BOOK @ $10
|
||||
Liabilities:MasterCard $-200.00
|
||||
|
||||
--- Input format string ---
|
||||
%12(scrub(amount))
|
||||
|
||||
--- Format elements ---
|
||||
Element: EXPR flags: 0x0 min: 12 max: 0 expr: scrub(amount)
|
||||
|
||||
--- Formatted string ---
|
||||
" 20 BOOK"
|
||||
>>>2
|
||||
=== 0
|
||||
Loading…
Add table
Reference in a new issue