Xcode 9 betas do not move to first non-whitespace character when indenting in leading whitespace

Originator:prachi
Number:rdar://33471936 Date Originated:July 22 2017, 9:00 AM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 9.0 beta 3
Classification:Bug Reproducible:Always
 
Summary:
In previous versions of Xcode, when the user re-indented a line with the tab key, the cursor would move to the first non-whitespace character on the line. If no there were no non-whitespace characters, the cursor would move to the point where indented text would start. Xcode 9 does not do this. 

For example, suppose the Tab key setting in Preferences:Text Editing:Indentation is set to “Indents always”, and the cursor is in the first column of line 2 below. 

1: func doSomething() {
2:     let lineInQuestion = "This one"
3:     print(lineInQuestion)
4: }

Pressing tab in Xcode 8 (and many, many versions prior) would move the cursor to column 5 (the l in let). In Xcode 9, nothing happens. Worse still, there doesn’t appear to be a single-key shortcut that can move to the indentation point. The best one I can find is cmd-right arrow, cmd-left arrow, which is far less convenient than just hitting the tab key.

Steps to Reproduce:
1. In Xcode’s preferences, navigate to  Text Editing:Indentation and set the Tab key popup to “Indents always.”
2. Open an Xcode 9 editing window containing Swift.
3. Paste the following code:

func doSomething() {
    let lineInQuestion = "This one"
    print(lineInQuestion)
}

4. Place the cursor anywhere in the leading whitespace of the line that starts with “let lineInQuestion.”
5. Press the tab key.

Expected Results:
Xcode will move the cursor to the first column containing a non-whitespace character, or if there are no whitespace characters, the first column where a non-whitespace character would occur if Xcode’s indentation rules were followed.

Observed Results:
Nothing happens.

Version:
Xcode 9.0 beta 3 (9M174d)
macOS Sierra 10.12.6 (16G29)

Notes:
Again, the Xcode 9 behavior is different than any Xcode version I can remember.

Configuration:

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!