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

Java Keyword Demo #400

Closed
WinXaito opened this issue Nov 21, 2016 · 5 comments
Closed

Java Keyword Demo #400

WinXaito opened this issue Nov 21, 2016 · 5 comments

Comments

@WinXaito
Copy link

Hello,

I would like to be able to refresh the "hightlight" when opening the file, but with this code, the "highlight" is only done after editing the file.

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

This is the code found in the java keyword demo in Async

How can I do this?

Thank you !

[This text has been translated from a translation site, original language: French]

@JordanMartinez
Copy link
Contributor

What have you tried so far?

@WinXaito
Copy link
Author

And well not much, what I would like to call codeArea.richChanges() without making a change in codeArea, but I do not know how to do it, you understand?

@WinXaito
Copy link
Author

Okay, I'm so sorry, I've resolved my problem.. But I don't know why. I have inversed my variable declaration and the problem has been solved.

So I have an another questions, codeArea.positionCaret(0); is indicated @deprecated, how can I use ? Thanks !

@JordanMartinez
Copy link
Contributor

No worries. You should be using codeArea.moveTo(absolutePosition) instead or its variant moveTo(paragraphIndex, linePosition)

@WinXaito
Copy link
Author

Okay. 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

2 participants