Jump to content

Get string on visual line (not wordwrapped) in a wordwrapped textarea?


dsaba

Recommended Posts

Hi is there an easy way (method, property) to get the string occupying a "visual line" in a wordwrapped textarea?

 

What I mean by visual line:

A string of characters that does not spill into the line below it and occupies one line on the textarea, even if this line strays into the right-side scrolling portion of the textarea. How would a wordwrapped textarea manage to have a horizontal scroll bar you ask? Well, a line will have horizontal scrollbar when the # of chars occupying the line are more than the width dimensions of the textarea AND there are no spaces in the line. ie: sdddddNOSPACESddddddsddddddddddddddddddddddd

 

 

A simpleton solution is to determine where there are linebreaks and after that determine where there are more characters than what fits on a line. That in itself is a debatable matter, because how many characters that fit on a textarea line depend on their pixel width which is not uniform for all characters in the same pixel setting. IE: in the same pixel size the char 'a' will have different pixel width than '.'

A line full of '.' will have more characters occupying it than a line full of 'a'

 

 

-thanks for reading

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.