mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Fixed: - CPTextField deleteBackward: required selection.
According to the spec, deleteBackward: should remove the element before the insertion point if there is no selection (e.g. actually delete backwards).
This commit is contained in:
@@ -1506,10 +1506,15 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
var selectedRange = [self selectedRange];
|
||||
|
||||
// FIXME Is deleteBackward: meant to delete the character before the caret if there's no
|
||||
// selection? There's no official documentation on deleteBackward: in Cocoa.
|
||||
if (selectedRange.length < 1)
|
||||
return;
|
||||
{
|
||||
if (selectedRange.location < 1)
|
||||
return;
|
||||
|
||||
// Delete a single element backward from the insertion point if there's no selection.
|
||||
selectedRange.location -= 1;
|
||||
selectedRange.length += 1;
|
||||
}
|
||||
|
||||
var newValue = [_stringValue stringByReplacingCharactersInRange:selectedRange withString:""];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user