Community
    • Login

    Tab spacing copying from Notepad++ into WordPress

    Scheduled Pinned Locked Moved General Discussion
    5 Posts 4 Posters 190 Views 2 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Robk BlueR Offline
      Robk Blue
      last edited by

      Hi,

      I’m having this strange issue where I am editing a css file in NP++ and have all my indentations perfect to 2 spaces. I then copy and paste the entire code from NP++ in to WordPress via Appearance > Editor > Styles > Additional CSS field.

      For some reason, the indentation of the pasted code in Additional CSS window is completely out of whack. The spacing varies from 4 to 8 and there’s no consistency at all, as if it completely randomises it. Because I sometimes edit my css directly in WordPress, it makes it awful to work with.

      Does anyone know what’s up with this?

      Thanks.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA Offline
        Alan Kilborn @Robk Blue
        last edited by Alan Kilborn

        @Robk-Blue said:

        indentations perfect to 2 spaces

        Does this mean that you have Notepad++ set up such that tab characters are visualized as two spaces, or that you aren’t using tab characters at all and simply have Notepad++ directly insert two spaces when you press the Tab key when your caret is in a tab-stop column?

        If you are inserting tab characters in your Notepad++ document, then copying your text to another program for processing allows that other program to interpret tab characters as it sees fit (which could easily be different from “two spaces” in Wordpress’s default handling).

        Possible solutions to your “problem” might be to stop using tab characters (if that’s truly what you are doing), or look into adjusting Wordpress’s settings for how to handle tab characters (if it has such settings).

        Robk BlueR 1 Reply Last reply Reply Quote 3
        • Robk BlueR Offline
          Robk Blue @Alan Kilborn
          last edited by Robk Blue

          @Alan-Kilborn

          Hi,

          Yes I’m using tab setting of 2.

          The problem seems to be weirder that just application processing tab characters differently because it’s not uniform. Like I said, in Notepad++, I have the same amount of tabs per line for clean formatting of my CSS file. Yet in the WP portal, the lines will have different amount of tabs/spaces, not all uniformly different by the same amount.

          For example, this is how it might appear in NP++
          . div {
          (2 spaces)display: block;
          (2 spaces)font-family: Arial;
          (2 spaces)text-align: right;
          (2 spaces)font-size: 20px;
          }

          In WordPress, it might look like this:
          . div {
          (2 spaces)display: block;
          (8 spaces)font-family: Arial;
          (4 spaces)text-align: right;
          (4 spaces)font-size: 20px;
          }

          Note: I had to represent the spaces in brackets as the forum editor removes them from my post.

          CoisesC PeterJonesP 2 Replies Last reply Reply Quote 1
          • CoisesC Online
            Coises @Robk Blue
            last edited by

            @Robk-Blue said:

            The problem seems to be weirder that just application processing tab characters differently because it’s not uniform. Like I said, in Notepad++, I have the same amount of tabs per line for clean formatting of my CSS file. Yet in the WP portal, the lines will have different amount of tabs/spaces, not all uniformly different by the same amount.

            I’m not sure where this will lead, but something worth checking might be this: After you have pasted your text into WordPress and you see the unexpected results, highlight and copy that text and paste it into a new Notepad++ tab. See if the text itself is changing, or if WordPress is just displaying it differently.

            Also of possible relevance to diagnosis:

            At Settings | Preferences… | Indentation have you selected Indent using Tab character or Space character(s)?

            At View | Show Symbols consider checkmarking Show Space and Tab, if you don’t already have it checked, so you can see anything unexpected that might be happening in your source file.

            Finally, showing us ? | Debug Info… is always a good idea; if for no other reason, to confirm no plugins are in use that might cause issues.

            1 Reply Last reply Reply Quote 0
            • PeterJonesP Online
              PeterJones @Robk Blue
              last edited by

              @Robk-Blue said:

              Yes I’m using tab setting of 2.

              The problem seems to be weirder that just application processing tab characters differently because it’s not uniform.

              That tells me that you probably have a mix of spaces and tabs, without realizing it. In Notepad++, use View > Show Symbol > Show Space and Tab. You will see a middot • for spaces, and an arrow → for tabs… the width of the arrow will grow to fit the remaining space in the tab-spacing

              b2bb93e2-ae0e-4350-a0df-1708f84dd276-image.jpeg

              (2 spaces)display: block;
              (8 spaces)font-family: Arial;
              (4 spaces)text-align: right;
              (4 spaces)font-size: 20px;
              

              So what this tells me is that your actual file, in Notpead++, is really as follows, with your WordPress being set to show 4 spaces per tab instead of two:

              [SPACE][SPACE]display: block;
              [TAB][TAB]font-family: Arial;
              [SPACE][TAB]text-align: right;
              [SPACE][TAB]font-size: 20px;
              

              Though the 8-wide version being two tabs surprises me, because that wouldn’t look aligned properly in Notepad++

              8cac1852-6a8b-4cfd-8a8b-635c5b5185ab-image.jpeg

              But my guess is it’s similar to that, if not that exactly.

              1 Reply Last reply Reply Quote 0

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors