-
Notifications
You must be signed in to change notification settings - Fork 236
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
Get exact LinesCount! #349
Conversation
muraee
commented
Aug 23, 2016
- new method getParagraphLinesCount, returns an integer of linesCount in a specific Paragraph using its index as parameter.
- getCaretBoundsOnScreen method in class StyledTextArea is now public, used to determine if the caret is outside the screen or not.
- getCaretBoundsOnScreen method is now public.
What exactly is "linesCount" ? Is that the number of Text objects stored a TextFlow's list of children? I'm not familiar with that API. |
@JordanMartinez a paragraph represents a Text (or TextField) object in a TextFlow (CodeArea), but still a TextField can store more than one line that is not necessarily separated by |
Oo! I can see why that would be very helpful. Putting it into my own words... If you have a really long line of text, and the wrap text feature is on, and the StyledTextArea (or one of its flavors) is not wide enough to display the entire long line, then this feature would tell you how many lines it takes to display that entire long line.
But wouldn't this only work for the content that is actually displayed? I may be misunderstanding you, but since most of the document isn't displayed, you still wouldn't be able to know how many lines it takes to display the entire document. Each line itself is a TextFlow; CodeArea is a VirtualFlow with many TextFlow objects (cells) as needed to display the content that fits within the viewport. |
Yes that is exactly what I meant. |
@TomasMikula any comments here? This PR has been open for a while now... |
Consider also a
The implementation for
As far as I can tell, this PR implies:
Not nearly as elegant as:
However, this would lead the developers to thinking that it is an accurate line count, which might not be possible to calculate quickly. At least not without extensive documentation that, on this PR, is lacking. |
This branch returns either 1 is wrapText is false or if wrapText is true it returns the number of signs. Am I doing something wrong or has this branch an error? |
Both features of this PR have been implemented in other PRs. The only one that hasn't is the one that @DaveJarvis mentioned: |