Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No vertical scrollbar since 0.7-M1 #311

Closed
Crystark opened this issue May 14, 2016 · 8 comments
Closed

No vertical scrollbar since 0.7-M1 #311

Crystark opened this issue May 14, 2016 · 8 comments

Comments

@Crystark
Copy link

Crystark commented May 14, 2016

Hi,

I just switch from a 2-weeks old 1.0.0-SNAPSHOT to 0.7-M1 and I seem to have lost the vertical scroll-bar in the editor. I can't even scroll with the mouse. I have to select the text and drag the mouse down so that the text field scrolls.

Tried reverting to 1.0.0-SNAPSHOT but that branch is now giving me the following error:

Caused by: java.lang.NoSuchMethodError: org.fxmisc.flowless.VirtualFlow.breadthOffsetProperty()Ljavafx/beans/property/ReadOnlyDoubleProperty;
    at org.fxmisc.richtext.StyledTextArea.createCell(StyledTextArea.java:1064)
    at org.fxmisc.richtext.StyledTextArea.lambda$new$3(StyledTextArea.java:549)
    at org.fxmisc.flowless.CellPool.getCell(CellPool.java:20)
    at org.fxmisc.flowless.CellListManager.cellForItem(CellListManager.java:75)
    at org.reactfx.collection.MappedList.get(MappedList.java:27)
    at org.reactfx.collection.MemoizationListImpl.get(MemoizationList.java:99)
    at org.fxmisc.flowless.CellListManager.getCell(CellListManager.java:64)
    at org.fxmisc.flowless.CellPositioner.getSizedCell(CellPositioner.java:129)
    at org.fxmisc.flowless.VirtualFlow.getCell(VirtualFlow.java:119)
    at org.fxmisc.richtext.StyledTextArea.followCaret(StyledTextArea.java:894)
    at org.fxmisc.richtext.StyledTextArea.layoutChildren(StyledTextArea.java:1035)
    at javafx.scene.Parent.layout(Parent.java:1079)
    at javafx.scene.Parent.layout(Parent.java:1085)
    at javafx.scene.Scene.doLayoutPass(Scene.java:552)
    at javafx.scene.Scene.preferredSize(Scene.java:1646)
    at javafx.scene.Scene.impl_preferredSize(Scene.java:1720)
    at javafx.stage.Window$9.invalidated(Window.java:846)
    at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:109)
    at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
    at javafx.stage.Window.setShowing(Window.java:922)
    at javafx.stage.Window.show(Window.java:937)
    at javafx.stage.Stage.show(Stage.java:259)

I reverted to 0.6.10 in the meantime.

@alt-grr
Copy link

alt-grr commented May 14, 2016

new VirtualizedScrollPane<>(new StyledTextArea());

@JordanMartinez
Copy link
Contributor

@Crystark In the release notes:

The scroll-pane has been decoupled from the main content. To get scroll-bars, one now needs to wrap StyledTextArea in a VirtualizedScrollPane.

See @kuc's example

new VirtualizedScrollPane<>(new StyledTextArea());

@Crystark
Copy link
Author

Crystark commented May 15, 2016

Just tried it and when I do so, i see a scroll bar but mouse scrolling doesn't work and clicking on the bar and dragging it up and down has an erratic behavior (sometimes scroll, sometimes doesn't).

stage = new Stage();
stage.setScene(new Scene(new StackPane(new VirtualizedScrollPane<>(new MyCodeArea()))));
stage.setMinWidth(600);
stage.setMinHeight(300);
stage.setWidth(760);
stage.setHeight(500);

I've extended CodeArea with to a class which adds syntax highlighting, a few keyboard shortcuts and bounds it to a file (to read/write). I don't think this can affect the scrollbar as it works fine with 0.6.10 but i thought i'd mention it.

@TomasMikula
Copy link
Member

I guess I broke the scrollbar dimensions in the latest snapshot (easy to fix), but otherwise they work. I also cannot reproduce the mouse scroll problem.

@TomasMikula
Copy link
Member

@Crystark I fixed the issue with scrollbars that I was referring to. Can you please provide a self-contained reproducible test case for the other issue?

@Crystark
Copy link
Author

@TomasMikula i'll try to see what i can do. It's kinda hard forme to extract it right now.

I've managed to isolate what was making it fail: it's the syntax highlighting:

        EventStream<?> richChanges = richChanges();
        richChanges
            .successionEnds(Duration.ofMillis(1))
            .supplyTask(this::computeHighlightingAsync)
            .awaitLatest(richChanges)
            .filterMap(t -> {
                if (t.isSuccess()) {
                    return Optional.of(t.get());
                }
                else {
                    t.getFailure().printStackTrace();
                    return Optional.empty();
                }
            })
            .subscribe(this::applyHighlighting);

I'll continue digging.

@Crystark
Copy link
Author

Fixed!

I changed it to:

        richChanges()
            .filter(ch -> !ch.getInserted().equals(ch.getRemoved()))
            .successionEnds(Duration.ofMillis(1))
            .supplyTask(this::computeHighlightingAsync)
            .awaitLatest(richChanges())
            .filterMap(t -> {
                if (t.isSuccess()) {
                    return Optional.of(t.get());
                }
                else {
                    t.getFailure().printStackTrace();
                    return Optional.empty();
                }
            })
            .subscribe(this::applyHighlighting);

As provided in the new example.

@Crystark
Copy link
Author

Crystark commented May 18, 2016

Ok it's all good.

new VirtualizedScrollPane<>(new StyledTextArea()); works like a charm!
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants