Skip to content

TextWrapped looks bad with decimal numbers due to hardcoded separators #8503

@vittorioromeo

Description

@vittorioromeo

Version/Branch of Dear ImGui:

1.91.9b

Back-ends:

Custom VRSFML (SFML Fork) + OpenGL ES 3.x Backend

Compiler, OS:

Windows 11 + MSYS2/UCRT64

Full config/build information:

No response

Details:

When using ImGui::TextWrapped to render text containing decimal numbers, the . character used to separate the integral part from the decimal part is considered as a wrap point, causing the end result to look quite bad as the number can be split across multiple lines.

The same issue occurs with the , character. The only workaround I've found is using the ' character, which looks quite weird, but at least it makes the numbers legible.

A probably-reasonable "fix" would be for the wrapping function to avoid wrapping . and , if both the preceding and succeeding characters are digits.

Screenshots/Video:

Screenshots from my game BubbleByte:

With normal decimal separator

With workaround

Minimal, Complete and Verifiable Example code:

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions