simonbs / Runestone

📝 Performant plain text editor for iOS with syntax highlighting, line numbers, invisible characters and much more.
MIT License
2.62k stars 145 forks source link

contentSize doesn't return real content size #355

Closed arthopar closed 4 months ago

arthopar commented 4 months ago

What happened?

When the text is big contentSize doesn't return real content size. I need to scroll to the end and after that contentSize returns real size

What are the steps to reproduce?

  1. Assigne big text to the Textview
  2. Get content size without scrolling the Textview
  3. Scroll down to the end and get content Size again

the content sizes in 2-rd step and 3-rd step are differ

What is the expected behavior?

The content sizes must be the same.

simonbs commented 4 months ago

This behavior is by design. In order to maximize performance, Runestone will typeset the text as the user scrolls, and only when all the text is typeset does it know the actual content size.

This behavior is inspired by UITableView, which also updates the content size continuously as the user scrolls when laying out cells using auto-layout.

07akioni commented 3 months ago

I wonder how to get the real content size since I want to use it as a readonly code block component?

Thanks!