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

Unified Diff: ui/views/controls/textfield/textfield_views_model.cc

Issue 8823007: Don't merge replace edit if previous edit is delete edit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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: ui/views/controls/textfield/textfield_views_model.cc
diff --git a/ui/views/controls/textfield/textfield_views_model.cc b/ui/views/controls/textfield/textfield_views_model.cc
index 5c509865363922aef86cd3dc26459aa4ad7eea88..9524903db9980fe795fe753446b76526bc084fb4 100644
--- a/ui/views/controls/textfield/textfield_views_model.cc
+++ b/ui/views/controls/textfield/textfield_views_model.cc
@@ -58,8 +58,8 @@ class Edit {
// successful, or false otherwise. Merged edit will be deleted after
// redo and should not be reused.
bool Merge(const Edit* edit) {
- if (edit->merge_with_previous()) {
- MergeSet(edit);
+ if (type_ != DELETE_EDIT && edit->merge_with_previous()) {
msw 2011/12/07 00:55:22 Interesting, please comment why DELETE_EDIT doesn'
oshima 2011/12/07 01:17:24 Done. I also improved the test to make this point
+ MergeReplace(edit);
return true;
}
return mergeable() && edit->mergeable() && DoMerge(edit);
@@ -113,10 +113,10 @@ class Edit {
// Returns the end index of the |new_text_|.
size_t new_text_end() const { return new_text_start_ + new_text_.length(); }
- // Merge the Set edit into the current edit. This is a special case to
+ // Merge the replace edit into the current edit. This is a special case to
// handle an omnibox setting autocomplete string after new character is
// typed in.
- void MergeSet(const Edit* edit) {
+ void MergeReplace(const Edit* edit) {
CHECK_EQ(REPLACE_EDIT, edit->type_);
CHECK_EQ(0U, edit->old_text_start_);
CHECK_EQ(0U, edit->new_text_start_);

Powered by Google App Engine
This is Rietveld 408576698