Formatting: Make if statement more readable

The if statement had a lot of sub-clauses. These were factored out into variable assignments.
This commit is contained in:
Andrew Hankinson
2014-08-13 19:56:50 -04:00
parent 1236dea4c5
commit 7f63be2cd2
+8 -3
View File
@@ -1211,10 +1211,15 @@ var kDelegateRespondsTo_textShouldBeginEditing
else
changedRange = _selectionRange;
if (_previousSelectionGranularity > 0 &&
changedRange.location > 0 && [self _isCharacterAtIndex:(changedRange.location - 1) granularity:_previousSelectionGranularity] &&
changedRange.location < [[self string] length] && [self _isCharacterAtIndex:CPMaxRange(changedRange) granularity:_previousSelectionGranularity])
var isCharacterAtLocationIndex = [self _isCharacterAtIndex:(changedRange.location - 1) granularity:_previousSelectionGranularity],
isCharacterAtMaxIndex = [self _isCharacterAtIndex:CPMaxRange(changedRange) granularity:_previousSelectionGranularity],
stringLength = [[self string] length];
if ((_previousSelectionGranularity > 0) && (changedRange.location > 0) && isCharacterAtLocationIndex &&
(changedRange.location < stringLength) && isCharacterAtMaxIndex)
{
changedRange.length++;
}
[self _deleteForRange:changedRange];
}