summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
diff options
context:
space:
mode:
authorderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-24 04:18:51 +0000
committerderat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-24 04:18:51 +0000
commit3b561568e9c250483af99a81c7438595bed666b7 (patch)
tree5eb951e4d60517844a3333b757abc2ef97dc84ef /chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
parenta81e294b0466f102ef592fd940f19441ef1cb980 (diff)
downloadchromium_src-3b561568e9c250483af99a81c7438595bed666b7.zip
chromium_src-3b561568e9c250483af99a81c7438595bed666b7.tar.gz
chromium_src-3b561568e9c250483af99a81c7438595bed666b7.tar.bz2
gtk: Restore omnibox text selection on tab switch.
Tested by: - highlighting omnibox text - switching to a different tab - highlighting some other text - switching back to the first tab - confirming that the omnibox highlighting was restored but PRIMARY didn't get updated when switching back BUG=20674 TEST=see above Review URL: http://codereview.chromium.org/440003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32914 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc15
1 files changed, 4 insertions, 11 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index 8966fbb..18a9c2c 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();