Skip to content

Commit 7149499

Browse files
committed
Add comments re BitcoinUnits::formatWithUnit/formatHtmlWithUnit
1 parent f7d70c6 commit 7149499

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/qt/bitcoinunits.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,21 @@ QString BitcoinUnits::format(int unit, qint64 n, bool fPlus, SeparatorStyle sepa
148148
}
149149

150150

151+
// TODO: Review all remaining calls to BitcoinUnits::formatWithUnit to
152+
// TODO: determine whether the output is used in a plain text context
153+
// TODO: or an HTML context (and replace with
154+
// TODO: BtcoinUnits::formatHtmlWithUnit in the latter case). Hopefully
155+
// TODO: there aren't instances where the result could be used in
156+
// TODO: either context.
157+
158+
// NOTE: Using formatWithUnit in an HTML context risks wrapping
159+
// quantities at the thousands separator. More subtly, it also results
160+
// in a standard space rather than a thin space, due to a bug in Qt's
161+
// XML whitespace canonicalisation
162+
//
163+
// Please take care to use formatHtmlWithUnit instead, when
164+
// appropriate.
165+
151166
QString BitcoinUnits::formatWithUnit(int unit, qint64 amount, bool plussign, SeparatorStyle separators)
152167
{
153168
return format(unit, amount, plussign, separators) + QString(" ") + name(unit);

0 commit comments

Comments
 (0)