Title
Handling of fill character width is underspecified in std::format
Status
resolved
Section
[format.string.std]
Submitter
Victor Zverovich

Created on 2021-11-13.00:00:00 last changed 21 months ago

Messages

Date: 2023-03-22.00:00:00

[ 2023-03-22 Resolved by the adoption of P2572R1 in Issaquah. Status changed: SG16 → Resolved. ]

Date: 2023-01-15.00:00:00

[ 2023-01-11; LWG telecon ]

P2572 would resolve this issue and LWG 3576.

Date: 2022-01-15.00:00:00

[ 2022-01-30; Reflector poll ]

Set priority to 3 after reflector poll. Sent to SG16.

Date: 2021-11-15.00:00:00

[ 2021-11-14; Daniel comments ]

Resolving this issue should be harmonized with resolving LWG 3576.

Date: 2021-11-13.00:00:00

[format.string.std] doesn't specify if implementations should consider the estimated width of the fill character when substituting it into the formatted results.

For example:

auto s = std::format("{:🤡>10}", 42);

"🤡" (U+1F921) is a single code point but its estimated display width is two.

There are at least three possible resolutions:

  1. s == "🤡🤡🤡🤡42": use the estimated display width, correctly displayed on compatible terminals.

  2. s == "🤡🤡🤡🤡🤡🤡🤡🤡42": assume the display width of 1, incorrectly displayed.

  3. Require the fill character to have the estimated width of 1.

History
Date User Action Args
2023-03-23 11:42:08adminsetmessages: + msg13489
2023-03-23 11:42:08adminsetstatus: open -> resolved
2023-01-11 18:22:42adminsetmessages: + msg13196
2022-01-30 17:05:36adminsetmessages: + msg12316
2022-01-30 17:05:36adminsetstatus: new -> open
2021-11-14 12:59:30adminsetmessages: + msg12221
2021-11-13 00:00:00admincreate