TextEditor Scrollbar bug

In some cases TextEditor shows a unnecessary horizontal scrollbar, but it disappears when moving the content. (This was somehow introduced a couple of month ago)

texteditor

Code to reproduce the bug

class MainComponent  : public juce::Component
{
public:
    //==============================================================================
    MainComponent()
    {
        addAndMakeVisible(&text);
        text.setMultiLine(true, true);
        text.setReadOnly(true);
        text.setText("The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. ");

        setSize(200, 100);
    };

    ~MainComponent() override
    {

    };

    //==============================================================================
    
    void resized() override
    {
        text.setBounds(getBounds());
    }

    juce::TextEditor text;

    JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MainComponent)
};

that would be known as overflow, its not a bug. I haven’t personally used JUCE text editors but i’m almost certain they simply call them scrollbars. if you dont want the scrollbar go to JUCE: TextEditor Class Reference and press CTRL+F, type scroll and flick thru some of the options, you can disable the bars. If that doesnt help lemme know

I think you misunderstood the problem here. The vertical scroll bars are necessary, the horizontal ones are not, and in fact they apparently disappear as soon as the content is moved (presumably with the vertical scrollbar), furthermore this is new behaviour.

It might be helpful @chkn if you git bisect to work out which commit introduced this new “feature”?

i see your point yes, however if you look at the way he has sized his container it appears LINE 3 ends with a space. making an estimated guess here, the padding combined with the space could be creating a false size reporting and it may be possible some change somewhere has created an error in removing whitespace.

It could then, with the false size reporting, once the display is changed update and fix any whitespacing issues.

1 Like

The issue was introduced here: @ed95

12bff68e34feea594ee52cc0e3909bd0571cf692 is the first bad commit
commit 12bff68e34feea594ee52cc0e3909bd0571cf692
Author: ed <eddavies95@gmail.com>
Date:   Mon Aug 3 18:28:21 2020 +0100

    Added vertical justification support to TextEditor

 examples/GUI/FontsDemo.h                           |  99 ++++++--
 .../juce_gui_basics/widgets/juce_TextEditor.cpp    | 254 ++++++++++++++-------
 modules/juce_gui_basics/widgets/juce_TextEditor.h  |  16 +-
 3 files changed, 259 insertions(+), 110 deletions(-)
1 Like

Thanks for reporting. This should be fixed on develop now:

1 Like