mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
In chooser lists, treat deleteToBeginningOfLine: as delete:
This is only if there is a responder for the delete: action and is done to allow ⌘⌫ to be used to delete items in the list (like favorites). The implementation is not ideal as we make assumptions about what action the ⌘⌫ key is bound to and perhaps it’s also a gotcha that ⌘⌫ in a text field will delete something else (though the list is also drawn as having focus).
This commit is contained in:
@@ -48,7 +48,9 @@
|
||||
- (BOOL)control:(NSControl*)aControl textView:(NSTextView*)aTextView doCommandBySelector:(SEL)aCommand
|
||||
{
|
||||
static auto const forward = new std::set<SEL>{ @selector(moveUp:), @selector(moveDown:), @selector(moveUpAndModifySelection:), @selector(moveDownAndModifySelection:), @selector(pageUp:), @selector(pageDown:), @selector(movePageUp:), @selector(movePageDown:), @selector(scrollPageUp:), @selector(scrollPageDown:), @selector(moveToBeginningOfDocument:), @selector(moveToEndOfDocument:), @selector(scrollToBeginningOfDocument:), @selector(scrollToEndOfDocument:), @selector(insertNewline:), @selector(insertNewlineIgnoringFieldEditor:), @selector(cancelOperation:) };
|
||||
if(forward->find(aCommand) != forward->end() && [self respondsToSelector:aCommand])
|
||||
if(aCommand == @selector(deleteToBeginningOfLine:) && [aControl.window tryToPerform:@selector(delete:) with:aControl])
|
||||
return YES;
|
||||
else if(forward->find(aCommand) != forward->end() && [self respondsToSelector:aCommand])
|
||||
return [NSApp sendAction:aCommand to:self from:aControl];
|
||||
return NO;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user