adobe/brackets — pull request #7153 by njx (2014-03-11 00:33:40+00:00)
Title: Implement Tab key heuristics for multiple selections

For #7022 - see the discussion in that issue as well as the comment at the beginning of `Editor._handleTabKey()` for a description of the exact heuristics involved.

Note that pretty much all the existing logic was rewritten, but the unit tests that were added in the first commit should verify that none of the existing desired behavior was broken in any of the single-select cases (aside from tweaks that were made to the existing behavior, as described in the issue thread).

Also note that I *didn't* change one bit of behavior that would be good to fix eventually: if you're immediately before the first non-whitespace character in a line and the line is improperly indented, hitting Tab just inserts an indent rather than autoindenting to the correct location. This is because we just rely on running CM's autoindent code in this case, and we don't want the autoindent to take effect if the line is already indented past the "correct" indentation - we want to just keep inserting tabs in that case. If we had a way to know whether we were past the "correct" indent level, we could fix this, but there isn't a good way to do that without implementing autoindent ourselves (which we could do by copying some of CM's code).