TextEditor Horizontal scroll bar not showing anymore

Since commit 7c96f18 TextEditors can’t show horizontal scrollbars, rather, I can’t find a way to show them. Before that commit, setting the TextEditor multiline was more than enough.

In juce_TextEditor.cpp at line 1456, the horizontal scrollbar is always set to false:

    viewport->setScrollBarsShown (scrollbarVisible
                                    && multiline
                                    && (textBottom > viewport->getMaximumVisibleHeight()),
                                  false);

Is there a new way to set the horizontal scrollbar?

Should they show it though? If line wrapping works right, all scrolling should be vertical. There were some recent commits fixing line wrapping and caret position / visibility, I think there shouldn’t be any horizontal scrolling after them.

Well, I’m not using line wrapping. I’m using TextEditor for some database dumping with a lot of data that should not be wrapped. Each line should have one entry, but without horizontal scrolling, I can’t easily move around. This is breaking retro compatibility without any warning (that I have seen?) or workaround to have the previous behavior. It should be possible to have an option to choose if you need horizontal and/or vertical scroll bars.

Point. I think this should do it:

viewport->setScrollBarsShown (scrollbarVisible
                                && multiline
                                && (textBottom > viewport->getMaximumVisibleHeight()),
                              scrollbarVisible
                                && multiline
                                && (textRight > viewport->getMaximumVisibleWidth()));

I guess something like that should work.

Thanks for reporting, this was an unintentional change. This commit on develop will add back in horizontal scrollbars for multi-line editors with word wrapping disabled. I’ve also updated the docs to make it a bit clearer when scrollbars will be shown.

1 Like

Thanks!