11-21-2008, 08:11 PM
When paste text from notepad or other editors into a TEXTAREA, we may have tabs in the text in the TEXTAREA.
How can I set the tab size for the TEXTAREA?
Thanks a lot for your helps in advance.
11-21-2008, 08:32 PM
Not sure on this but...
When you press tab in a text area it will jump to the next element and will not indent as intended.
A workaround is a button that tabs for you on click or a special js box.
11-21-2008, 08:50 PM
I don't need to press tab in a TEXTAREA.
I need to set the tab size for the text in a TEXTAREA.
11-21-2008, 08:54 PM
Um, you can't. It's displayed how the OS wants it to be. I don't see why you can't do a search & replace before you paste it in?
11-21-2008, 09:07 PM
11-21-2008, 09:17 PM
I don't think that's what he's talking about. I think (at least) that he's talking about the physical tab character (displayed as 8 consecutive spaces on Windows, I think 4 on OS X.) Unless I'm mistaken?
11-21-2008, 11:15 PM
I take it that the OP is talking about text that contains tab spaces and is copied and pasted into the textarea, and he wants to have control over these tab spaces when pasting into the textarea.
Ain’t got no solution, though.
11-21-2008, 11:16 PM
"I don't see why you can't do a search & replace before you paste it in?"
Replace to what? I still need the tabs(not spaces), but with the size I/users want.
11-21-2008, 11:17 PM
Can we have context? You talk about a textarea, but how will it be displayed? What is this?
11-22-2008, 12:48 AM
For example, there is a line with a tab in VC++ editor:
somebody copied+pasted it into a TEXTAREA in a forum, it might become
the tab still there but with longer space.
If replace the tab with 4 spaces the line will look the same as in VC++ editor. However, this method might not work when the tab is not at the start of the line.
11-22-2008, 12:58 AM
Does it really matter? I mean, really? At the end of the day, the code is code. All that will happen is that indents are doubled, which isn't really a major thing.
If you're really that fussy (I don't like tabs anyway, due to the platform-dependant rendering), using spaces will solve the problem. They tend not to be collapsed. I can't think of a situation where they would be in code.
font: .875em/1.8 verdana, sans-serif;
for example, will not have spaces collapsed (intial indent + 1.8 to verdana.)
11-22-2008, 05:33 AM
Thank you very much!