Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Unified Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc

Issue 440003: gtk: Restore omnibox text selection on tab switch. (Closed)
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 8966fbb5d9ea42a464d27b0554a1996dda2ce820..18a9c2cde775c18f13fac86d32ac616e06b4362c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -331,17 +331,10 @@ void AutocompleteEditViewGtk::Update(const TabContents* contents) {
model_->RestoreState(state->model_state);
// Move the marks for the cursor and the other end of the selection to
- // the previously-saved offsets.
- GtkTextIter selection_iter, insert_iter;
- ItersFromCharRange(
- state->view_state.selection_range, &selection_iter, &insert_iter);
- // TODO(derat): Restore the selection range instead of just the cursor
- // ("insert") position. This in itself is trivial to do using
- // gtk_text_buffer_select_range(), but then it also becomes necessary to
- // invalidate hidden tabs' saved ranges when another tab or another app
- // takes the selection, lest we incorrectly regrab a stale selection when
- // a hidden tab is later shown.
- gtk_text_buffer_place_cursor(text_buffer_, &insert_iter);
+ // the previously-saved offsets (but preserve PRIMARY).
+ StartUpdatingHighlightedText();
+ SetSelectedRange(state->view_state.selection_range);
+ FinishUpdatingHighlightedText();
}
} else if (visibly_changed_permanent_text) {
RevertAll();

Powered by Google App Engine
This is Rietveld 408576698