From f9f152b2873ba3cf8f2db2fb77b261cb243503f6 Mon Sep 17 00:00:00 2001 From: "rohitrao@chromium.org" Date: Fri, 17 Jul 2009 20:50:27 +0000 Subject: Makes enter/shift-enter find next/previous on Mac. BUG=htp://crbug.com/14890 TEST=Cmd-F to find in page. Type a word into the box, then ensure that pressing Enter finds the next instance, Shift-Enter finds the previous instance. Review URL: http://codereview.chromium.org/149100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20996 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/cocoa/find_bar_cocoa_controller.mm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'chrome/browser') diff --git a/chrome/browser/cocoa/find_bar_cocoa_controller.mm b/chrome/browser/cocoa/find_bar_cocoa_controller.mm index d343577..58e687c 100644 --- a/chrome/browser/cocoa/find_bar_cocoa_controller.mm +++ b/chrome/browser/cocoa/find_bar_cocoa_controller.mm @@ -96,6 +96,25 @@ } } +// NSControl delegate method +- (BOOL)control:(NSControl*)control + textView:(NSTextView*)textView + doCommandBySelector:(SEL)command { + if (command == @selector(insertNewline:)) { + NSEvent* event = [NSApp currentEvent]; + + if ([event modifierFlags] & NSShiftKeyMask) + [previousButton_ performClick:nil]; + else { + [nextButton_ performClick:nil]; + } + + return YES; + } + + return NO; +} + // Methods from FindBar - (void)showFindBar { [[self view] setHidden:NO]; -- cgit v1.1