title: Indentation bug in Xcode
body: <p>I've come across this a few times lately. I cannot isolate what causes it, but it happens if there's a line with a <code>cout</code> statement. Not always of course, it's kind of rare, but when it does happen, it is caused by a line that begins with <code>cout</code>.</p>
  
  <p>It works like this: after the "faulty" <code>cout</code> line, Xcode automatically indents the code one or two levels more than it should. Every time I press the enter key to start writing on a new line, the code will be unnecessarily indented. There's nothing wrong with the code itself, there are no grammatical errors or anything. Just a simple <code>cout &lt;&lt; someString &lt;&lt; endl;</code> line. But if I get rid of that line, or comment it out, Xcode will use the right amount of indentation, so everything is back to normal. If I uncomment it, the indentation of the following lines is screwed up once again. Even if I delete that whole section of code and rewrite it (in case there's a funky invisible unicode in character in there or something), the same thing happens.</p>
  
  <p>The most annoying thing is that this cannot be reproduced quite easily. I write C++ code fairly often, and only came across this two or three times, in totally unrelated contexts (different projects, different kinds of code, etc.). The only common thing is that it's always a <code>cout</code> statement that messes with the indentation of the following lines.</p>
  
  <p>Btw, I recently did a clean install of OS X on my mac, and downloaded a fresh copy of Xcode from the Mac App Store, so I don't think that anything is corrupted or something.</p>
  
  <p>Has anyone else noticed this? I can't seem to find a single mention of anything like this on the internet. Should I contact Apple about it or something?</p>
  
  <p><strong><em>Edit (2015. 11. 29.):</em></strong></p>
  
  <p>The problem still exists in Xcode 7.1.1 on OS X 10.11.1. Here's a picture:</p>
  
  <p><a href="https://i.stack.imgur.com/5NUh8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5NUh8.png" alt="Code"></a></p>
  
  <p>As you can see, the indentation of the lines that follow the <code>cout</code> line is messed up. Even if I select this entire piece of code and select "Re-Indent", Xcode will not fix it. In fact, even if I fix it by hand, the "Re-Indent" option will revert it back to this messed up state. And again, this happens to me in completely different projects, all created at different times, on different versions of Xcode. I have re-installed OS X (cleanly!) since I posted this question originally, and things haven't changed. This is why I'm sure it's some kind of bug in Xcode itself.</p>