Index: chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc |
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc |
index 5bad09c6fed0e8747efbecc6771d620af0f77b66..fa26b97b469bc7d4272fe3f606266b4b90cae54e 100644 |
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc |
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc |
@@ -513,6 +513,7 @@ std::wstring AutocompleteEditViewGtk::GetText() const { |
out.insert(gtk_text_iter_get_offset(&start), preedit_); |
} |
#endif |
+ |
return out; |
} |
@@ -1385,18 +1386,32 @@ void AutocompleteEditViewGtk::HandleBackSpace(GtkWidget* sender) { |
void AutocompleteEditViewGtk::HandleViewMoveFocus(GtkWidget* widget, |
GtkDirectionType direction) { |
+ if (!tab_was_pressed_) |
+ return; |
+ |
+ // If special behavior is triggered, then stop the signal emission to |
+ // prevent the focus from being moved. |
+ bool handled = false; |
+ |
// Trigger Tab to search behavior only when Tab key is pressed. |
- if (tab_was_pressed_ && enable_tab_to_search_ && |
- model_->is_keyword_hint() && !model_->keyword().empty()) { |
- model_->AcceptKeyword(); |
+ if (model_->is_keyword_hint() && !model_->keyword().empty()) { |
+ if (enable_tab_to_search_) { |
+ model_->AcceptKeyword(); |
+ handled = true; |
+ } |
+ } else { |
+ if (GTK_WIDGET_VISIBLE(instant_view_)) |
+ controller_->OnCommitSuggestedText(GetText()); |
+ else |
+ controller_->AcceptCurrentInstantPreview(); |
+ |
+ handled = true; |
James Su
2010/12/01 02:18:33
Should handled always be set to true here? Looks l
Evan Stade
2010/12/01 04:00:58
thanks for pointing that out. Fixed. I also fixed
|
+ } |
- // If Tab to search behavior is triggered, then stop the signal emission to |
- // prevent the focus from being moved. |
+ if (handled) { |
static guint signal_id = g_signal_lookup("move-focus", GTK_TYPE_WIDGET); |
g_signal_stop_emission(widget, signal_id, 0); |
} |
- |
- // Propagate the signal so that focus can be moved as normal. |
} |
void AutocompleteEditViewGtk::HandleCopyClipboard(GtkWidget* sender) { |