diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 20:50:27 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-17 20:50:27 +0000 |
commit | f9f152b2873ba3cf8f2db2fb77b261cb243503f6 (patch) | |
tree | fab0afe316a040aee133d35fb0c6661b170143d3 /chrome/browser | |
parent | f714394a299cc645b5d7777722b66b398a2fea8e (diff) | |
download | chromium_src-f9f152b2873ba3cf8f2db2fb77b261cb243503f6.zip chromium_src-f9f152b2873ba3cf8f2db2fb77b261cb243503f6.tar.gz chromium_src-f9f152b2873ba3cf8f2db2fb77b261cb243503f6.tar.bz2 |
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
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/cocoa/find_bar_cocoa_controller.mm | 19 |
1 files changed, 19 insertions, 0 deletions
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]; |