Don't make space for editing in token field if tokens are selected.

If the editor is placed while there is a token selection it can cause the token view to become scrollable to a white area at the bottom even that there is no editing cursor. And even if the editor is not at the bottom, the empty space made for the editor makes no sense when no editing cursor is visible.
This commit is contained in:
Alexander Ljungberg committed 2012-06-16 12:31:50 +01:00
1 parent d5918157ff
commit 44b609f604
1 file changed
+2 -2
+2 -2
View File
@@ -999,7 +999,7 @@ var CPScrollDestinationNone = 0,
for (var i = 0, count = [tokens count]; i < count; i++)
{
if (isEditing && i == _CPMaxRange(_selectedRange))
if (isEditing && !_selectedRange.length && i == _CPMaxRange(_selectedRange))
placeEditor(false);
var tokenView = [tokens objectAtIndex:i];
@@ -1018,7 +1018,7 @@ var CPScrollDestinationNone = 0,
[tokenView setFrame:tokenFrame];
}
if (isEditing && _CPMaxRange(_selectedRange) >= [tokens count])
if (isEditing && !_selectedRange.length && _CPMaxRange(_selectedRange) >= [tokens count])
placeEditor(true);
// Hide the editor if there are selected tokens, but still keep it active