diff options
author | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 05:28:12 +0000 |
---|---|---|
committer | isherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-17 05:28:12 +0000 |
commit | 4010042b40699583b8ab04d8a06197e69240d025 (patch) | |
tree | a4f540f9d45f2a24a737714bbecb532082ad7b50 | |
parent | a4e1d2e8b74a3373332a3992e3bbc97a2f73fb1c (diff) | |
download | chromium_src-4010042b40699583b8ab04d8a06197e69240d025.zip chromium_src-4010042b40699583b8ab04d8a06197e69240d025.tar.gz chromium_src-4010042b40699583b8ab04d8a06197e69240d025.tar.bz2 |
Update omnibox popup when selection changes.
The original motivation for this cl corresponds to bug 47210: If the user changes the selection by arrowing around in the omnibox, we should detect this as accepting the inline autocomplete suggestion. Otherwise, if the user subsequently presses ctrl (e.g. as part of the keystroke ctrl-d to perform a forward delete), the omnibox contents are reverted as if the user had never arrowed around.
The other motivation is just to match the behavior on Windows, which detects changes to the selection.
BUG=47210
TEST=none
Review URL: http://codereview.chromium.org/3126024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59770 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.mm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.mm b/chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.mm index 9304474..9713e10 100644 --- a/chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.mm +++ b/chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.mm @@ -271,6 +271,17 @@ [self didChangeText]; } +- (void)setSelectedRange:(NSRange)charRange + affinity:(NSSelectionAffinity)affinity + stillSelecting:(BOOL)flag { + [super setSelectedRange:charRange affinity:affinity stillSelecting:flag]; + + // We're only interested in selection changes directly caused by keyboard + // input from the user. + if (interpretingKeyEvents_) + textChangedByKeyEvents_ = YES; +} + - (void)interpretKeyEvents:(NSArray *)eventArray { DCHECK(!interpretingKeyEvents_); interpretingKeyEvents_ = YES; |