On Linux and Windows, between 6.0.8 and 6.1, the CodeEditorComponent no longer respects start-of-line spaces in the document. It seems commit e1366361ed99bcf238327b91e7c19e1b12c60b52 broke this.
Here’s the Surge lua modulator in 6.0.8 on ubuntu 20.04
Did a git bisect while drinking my morning coffee.
e1366361ed99bcf238327b91e7c19e1b12c60b52 is the first bad commit
commit e1366361ed99bcf238327b91e7c19e1b12c60b52
Author: ed <eddavies95@gmail.com>
Date: Wed Jul 7 09:40:40 2021 +0100
TextLayout: Skip whitespace tokens in TokenList::createLayout() to fix misalignment when using horizontally centred justification
that’s the commit that broke it between 6.0.8 and 6.1 @ed95 FYI
Oh also, when you go mid line and press space, the space gets put in in the wrong spot (basically ignoring the stripped whitespace). So seems this commit has totally broken the CodeDocumentEditor on linux.
No idea why it only breaks linux and not mac. will dig some more this weekend unless someone shares a thought here.
The problem is entirely in the choice to skip whitespace tokens in the glyph construction (which matches what we see of course). This diff “fixes” the problem but I think it unfixes whatever the intent of the diff was
Fyi i forked juce and am now running surge on 6.1.0 with the above commit reverted and our Linux and windows users report things work. Will undo the fork when the issue is resolved but no urgency for our dev cycle. Thanks and let me know if you need anything else to reproduce!
Thanks for the report. We’ve reverted the problematic commit in 2be72f6. This is on develop now and there will be a minor bugfix release in the next couple of weeks so it’ll make it’s way onto the master branch soon.
This effectively unfixes the issue with centred text though: tooltips are off-centre again. As there’s currently no way to get the size of a layout without trailing whitespace, I’ll resort to using GlyphArrangement with a fixed width.
No problem, I just mentioned in case it went unnoticed. I’d try to help but I can’t reproduce the bug on Windows, either with \n or \r\n, either in the Projucer, the DemoRunner or a minimal example.
On Windows and macOS the default is to use the native DirectWrite/CoreText layout APIs, respectively, so you need to force the JUCE TextLayout code path to see the bug. Commenting out this line will do it.
FYI: Surge showed the problem on windows also but we are using a memory-loaded TTF font; from reading the windows code it seems like the that case may fall through to the same codepath as linux maybe?
Yeah I never could figure out custom fonts from ttf in vstgui (which uses dw2d). But the fact that you fall back explains another tiny regression in our port. Thanks!