Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to set the tab size for a TEXTAREA?

    Hi,

    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.

  • #2
    Senior Coder twodayslate's Avatar
    Join Date
    Mar 2007
    Location
    VA
    Posts
    1,042
    Thanks
    67
    Thanked 39 Times in 39 Posts
    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.
    twitter | Quality Hosting - $5.95/mo*
    Feel free to PM me!

  • #3
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you.

    I don't need to press tab in a TEXTAREA.
    I need to set the tab size for the text in a TEXTAREA.

  • #4
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    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?

  • #5
    Senior Coder twodayslate's Avatar
    Join Date
    Mar 2007
    Location
    VA
    Posts
    1,042
    Thanks
    67
    Thanked 39 Times in 39 Posts
    twitter | Quality Hosting - $5.95/mo*
    Feel free to PM me!

  • #6
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by twodayslate View Post
    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?

  • #7
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,676
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    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.

  • #8
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    CyanLight,

    Thank you.

    "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.

  • #9
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Can we have context? You talk about a textarea, but how will it be displayed? What is this?

  • #10
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For example, there is a line with a tab in VC++ editor:
    ____int a;

    somebody copied+pasted it into a TEXTAREA in a forum, it might become
    ________int a;
    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
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    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.
    Code:
    body {
        font: .875em/1.8    verdana, sans-serif;
    }
    for example, will not have spaces collapsed (intial indent + 1.8 to verdana.)

  • #12
    New to the CF scene
    Join Date
    Nov 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    CyanLight,

    Thank you very much!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •