Comment #16 on issue 21587 by [email protected]: REGRESSION: Omnibox  
does nothing when pressing enter after a single character of input
http://code.google.com/p/chromium/issues/detail?id=21587

The following revision refers to this bug:
     http://src.chromium.org/viewvc/chrome?view=rev&revision=26315

------------------------------------------------------------------------
r26315 | [email protected] | 2009-09-15 18:21:53 -0700 (Tue, 15 Sep 2009)  
| 43 lines
Changed paths:
    M  
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc?r1=26315&r2=26314
    M  
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc?r1=26315&r2=26314
    M  
http://src.chromium.org/viewvc/chrome/trunk/src/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h?r1=26315&r2=26314

Fix issue 21587, a regression of CL 196020.

This CL fixes issue 21587: REGRESSION: Omnibox does nothing when pressing  
enter after a single character of input.

It's a regression of my CL: http://codereview.chromium.org/196020, which  
reverts the text of omnibox in OnAfterPossibleChanges(), when enter key is  
pressed:

...
   // If the change is caused by an Enter key press event, and the event was  
not
   // handled by IME, then it's an unexpected change and shall be reverted  
here.
   // {Start|Finish}UpdatingHighlightedText() are called here to prevent the
   // PRIMARY selection from being changed.
   if (enter_was_pressed_ &&
       (char_inserted_ == '\n' || char_inserted_ == '\r')) {
     StartUpdatingHighlightedText();
     SetTextAndSelectedRange(text_before_change_, sel_before_change_);
     FinishUpdatingHighlightedText();
     return false;
   }
...

Unfortunately, this piece of code causes the char_inserted_ to be set to  
wrong value in HandleInsertText(), if the text has only one character. See  
the source code of HandleInsertText():

...
   // Filter out new line and tab characters.
   // |text| is guaranteed to be a valid UTF-8 string, so it's safe here to
   // filter byte by byte.
   //
   // If there was only a single character, then it might be generated by a  
key
   // event. In this case, we save the single character to help our
   // "key-press-event" signal handler distinguish if an Enter key event is
   // handled by IME or not.
   if (len == 1)
     char_inserted_ = text[0];
...

This CL uses a boolean |enter_was_inserted_| instead of char | 
char_inserted_| to record the enter key status, to make sure it won't be  
reset unexpectly.

The test has been updated to cover this case. An unexpected dns lookup  
issue in the test which causes a failure on Windows was also fixed.

BUG=21587: REGRESSION: Omnibox does nothing when pressing enter after a  
single character of input.
TEST=Input one character in omnibox and press enter, the default link  
matched with the character should be opened.

Review URL: http://codereview.chromium.org/200131
------------------------------------------------------------------------


--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

--~--~---------~--~----~------------~-------~--~----~
Automated mail from issue updates at http://crbug.com/
Subscription options: http://groups.google.com/group/chromium-bugs
-~----------~----~----~----~------~----~------~--~---

Reply via email to