Count lines in textarea?

B

bwucke

It seems you can't scroll textarea using JS in Opera. - scrollTop
ignored. Seems the only way to keep appended content within view is to
remove enough content from start so that it will all fit. And here we
come to the tricky part, counting real physical lines occupied by text,
so we could know if there's still need to trim or not. Considering
linewraps, tabs, newlines, possibly scalable fonts, possibly scalable
textarea itself...

My try at the problem. http://www.kurs.horsesport.pl/inne/testcase.html
Of course it's broken (otherwise I wouldn't ask). I guess I could add
support for counting tabs, and given a reliable column count even
reliably estimate differences coming from word wrap but I'm completely
stumped when it comes to counting width and height with at least
moderate reliablity. (I know Opera gets them wrong, any workarounds?)

Any ideas, suggestions, solutions?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top