Comment #9 on issue 4203 by [EMAIL PROTECTED]: When omnibox has focus  
and no drop down, ESC should select the whole line
http://code.google.com/p/chromium/issues/detail?id=4203

I think your instincts are generally right.  I would make a couple changes  
to the
code you give above:
* When !user_input_in_progress_, check whether everything is selected  
already.  If
so, just return false.  If not, select all, and return true.  This makes  
<esc> stop a
load only if it didn't do anything in the edit.  (I don't know what Firefox  
does in
this case, testing is probably warranted.)
* Reorganize the resulting code to minimize exit points:

{
   if (has_temporary_text_ &&
       (popup_->URLsForCurrentSelection(NULL, NULL, NULL) != original_url_))  
{
     // The user typed something, then selected a different item.  Restore  
the
     // text they typed and change back to the default item.
     // NOTE: This purposefully does not reset paste_state_.
     just_deleted_text_ = false;
     has_temporary_text_ = false;
     keyword_ui_state_ = original_keyword_ui_state_;
     popup_->ResetToDefaultMatch();
     view_->OnRevertTemporaryText();
     return true;
   }

   // If the user wasn't editing, but merely had focus in the edit, allow  
<esc> to
   // be processed as an accelerator, so it can still be used to stop a  
load.  When
   // the permanent text isn't all selected we still fall through to the  
SelectAll()
   // call below so users can arrow around in the text and then hit <esc> to  
quickly
   // replace all the text; this matches IE.
   if (!user_input_in_progress_ && view_->IsSelectAll())
     return false;

   view_->RevertAll();
   view_->SelectAll(true);
   return true;
}

Note that the change above won't compile as-is due to the IsSelectAll()  
call; right
now that function is private and expects a CHARRANGE argument.  I suggest  
renaming
the existing function something like IsSelectAllForRange(); adding a new  
public
function called IsSelectAll() that take no argmuents, calls GetSel() and  
passes the
result to IsSelectAllForRange(); and then also modifying OnPaste() to use  
this
version.

-- 
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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/chromium-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to