[TxMt] Soft wrap wraps too early for non-monospaced fonts

Kim Ahlström kim.ahlstrom at gmail.com
Tue Aug 9 09:24:35 UTC 2016


Hi,

I noticed recently that the nightly builds started wrapping non-monospaced long before the line hits the soft wrap column or window frame.

To reproduce:
1. Make a new document
2. Type lorem<tab> to get the lorem ipsum snippet
3. Open View->Font->Show Fonts
4. Select a monospaced font like Courier
5. Select View->Enable Soft Wrap
6. Select View->Wrap Column->Use Window Frame
7. Resize the width of the window and note how the text wraps by the window frame
8. In the font panel, change to a non-monospace font like Helvetica
9. Resize the width of the window and note how the text wraps a good bit before the window frame

Expected result is that step 9 behaves like step 7.

After a little bit of sleuthing I think the relevant commit is https://github.com/textmate/textmate/commit/f487c5d57585f98d16273e0fa63b8a3d7c343df0

The character used to calculate column width changed from m to n, which doesn’t matter for monospaced fonts, but for non-monospaced fonts it can be quite a difference.

Would it be possible to change back to n?

Although this can have the opposite effect of the line sometimes overshooting the window frame by a tiny bit before soft wrapping. To fully fix this you would have to calculate the soft wrap width of each individual line, but I presume that that is quite a big change and could present speed issues with large files.

Cheers and thank you for TextMate,
Kim


More information about the textmate mailing list