enkisoftware / imgui_markdown

Markdown for Dear ImGui
zlib License
1.03k stars 69 forks source link

Link description text does not word wrap #24

Closed anup-das closed 1 year ago

anup-das commented 1 year ago

The link description text (the one inside of [ ] ) is broken / split and does not word wrap. I have a single word for the description text and it gets split

See the attached screenshot where the single word "online" is split image

juliettef commented 1 year ago

Thanks, will take a look when we have the time

dougbinks commented 1 year ago

I have a commit on the dev branch which may fix this, could you try it and check it doesn't break anything else you have with links?

This occurs because Dear ImGui's CalcWordWrapPositionA assumes the given width is for an entire line, so if it can't fit at least one word it gives up on trying to find a word break. I've added some logic to try to detect if there is a word break on the next line, and move to this if so.