Home Download Buy Blog Forum Support

ST3 Bug: Indenting moves in HTML

ST3 Bug: Indenting moves in HTML

Postby MattDMo on Sat Sep 07, 2013 8:26 pm

I just ran across this issue on SuperUser (http://superuser.com/questions/641878/sublime-text-3-html-auto-indent-issue) and figured out a workaround, but I figured I'd post it here as well.

In HTML mode, open up a tag like a div, hit enter twice, close the div, then go back up a line and hit Tab to start entering another tag, like so (the | is the cursor):
Code: Select all
<div class="someClass">
    |
</div>

As soon as you type a character (it can be any character, not just a < for opening a new tag), the indenting slides to the left and whatever you're typing is now aligned with the <div> tags:
Code: Select all
<div class="someClass">
<|
</div>

The original poster saw this on Win7 and Win8, and I confirmed it on OSX 10.8.4. There was a comment indicating someone did not see the behavior on Linux x64, but I can't confirm that.

I did come up with a workaround, though. Open the tag like usual, then without hitting enter or anything, immediately close it. Position your cursor between the opening and closing tags:
Code: Select all
<div class="someClass">|</div>

Then, hit Enter and your cursor is placed where it was in the first code block above. You can now type anything you want and the indenting stays put. However, if your cursor is at first indented:
Code: Select all
<div class="someClass">
    |
</div>

and you hit backspace to delete the automatically-inserted tab, then manually insert it again, when you start typing the line will be de-indented back to the beginning, just like in the original problem.

Hopefully someone in the know can track this down and fix it.

Thanks for your time!
MattDMo
MattDMo
 
Posts: 36
Joined: Thu Jan 17, 2013 3:15 am
Location: near Boston

Re: ST3 Bug: Indenting moves in HTML

Postby xtian on Thu Mar 20, 2014 5:08 pm

This is really annoying and also occurs when creating tags with the XML/long-tag snippet.
xtian
 
Posts: 1
Joined: Thu Mar 20, 2014 5:06 pm

Re: ST3 Bug: Indenting moves in HTML

Postby there4 on Fri Apr 11, 2014 1:32 pm

+1
there4
 
Posts: 1
Joined: Fri Apr 11, 2014 1:31 pm


Return to Technical Support

Who is online

Users browsing this forum: eyalzek, Yahoo [Bot] and 16 guests