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

[0.7-M5] Question: How to retrieve only visible text #492

Closed
clartaq opened this issue Apr 22, 2017 · 3 comments
Closed

[0.7-M5] Question: How to retrieve only visible text #492

clartaq opened this issue Apr 22, 2017 · 3 comments
Labels

Comments

@clartaq
Copy link

clartaq commented Apr 22, 2017

Is there any API to retrieve only the text that is visible on-screen along with the indices of it's beginning and end in a larger document?

The use case for this would be editing long documents within a virtual scroll pane. For example, languagetool can be used to check for spelling and grammar problems in a doc being edited. Real-time checking works fine for short documents, but analysis becomes too long as the document grows. An alternative would be to do analysis after a period of inactivity, like StackOverflow handles syntax highlighting, for example. But it would be better to be able to do the analysis as the text is entered.

Analyzing only the portion of the document shown on screen would be perfectly acceptable and performant if there were a way to get it programmatically.

@JordanMartinez
Copy link
Contributor

At this time, no. This is something that would need to be exposed in Flowless before it could be exposed in RichTextFX. The real solution would be to show which paragraphs are visible (whether partially or not) on top of which you could then implement that feature.

@JordanMartinez
Copy link
Contributor

I'm currently adding support for this in #501. Part of me feels like I should expose the ParagraphBox as well because then one could do bounds-related things, but I think that would need further discussion from more people.

@JordanMartinez
Copy link
Contributor

This is now possible via #501. You can use getVisibleParagraphs().map(Paragraph::getText)

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

No branches or pull requests

2 participants