Trailing spaces get trimmed prematurely

Originator:thedov
Number:rdar://19749444 Date Originated:06-Feb-2015 04:38 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.1.1 (6A2008a)
Classification:Other Bug Reproducible:Always
 
Summary:
It used to be that Xcode (as of version 5 and earlier, I believe) would trim trailing spaces when you save the file you’re working on. Now it trails the spaces as soon as the cursor moves to a new line.

Steps to Reproduce:
(I’ll use a Swift example, but it happens for Swift and Objective-C code)
1. In an open Xcode file, type “let x = “ (note the trailing space)
2. Copy a variable name from elsewhere in the file
3. Click to the right of the “=“ typed in step 1
4. Paste the copied variable name
5. Type on the next line: “let y = “
6. Save the file

Expected Results:
The pasted variable name gets placed after the space typed originally, and the trailing space typed in step 5 gets removed after step 6

Actual Results:
The variable name gets pasted immediately next to the “=“ in step 4

Regression:
Xcode didn’t behave like this previously. I can’t remember whether it was Xcode 5 or 6 that introduced this behavior. I believe it was 6

Notes:
This is incredibly disruptive to the way I code, since my muscle memory has me type the “ = “ all at the same time, like I do in every other code editor

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!