mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-29 21:57:41 +00:00
Fixes #1398. Fixed with CPTokenField: deleting tokens in front of selected tokens would shift the selection to the right.
This commit is contained in:
@@ -270,8 +270,13 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
var indexOfToken = [[self _tokens] indexOfObject:token],
|
||||
objectValue = [self objectValue];
|
||||
|
||||
// If the token was selected, deselect it for selection preservation.
|
||||
[self _deselectToken:token];
|
||||
// If the selection was to the right of the deleted token, move it to the left. If the deleted token was
|
||||
// selected, deselect it.
|
||||
if (indexOfToken < _selectedRange.location)
|
||||
_selectedRange.location--;
|
||||
else
|
||||
[self _deselectToken:token];
|
||||
|
||||
// Preserve selection.
|
||||
var selection = CPCopyRange(_selectedRange);
|
||||
[objectValue removeObjectAtIndex:indexOfToken];
|
||||
|
||||
Reference in New Issue
Block a user