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

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

Issue 7841056: fix know issues in RenderText (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: fix a capitalization in break_iterator.h Created 9 years, 3 months 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: views/controls/textfield/textfield_views_model.cc
===================================================================
--- views/controls/textfield/textfield_views_model.cc (revision 102037)
+++ views/controls/textfield/textfield_views_model.cc (working copy)
@@ -320,7 +320,10 @@
if (HasCompositionText())
ConfirmCompositionText();
size_t save = GetCursorPosition();
- MoveCursorRight(gfx::LINE_BREAK, false);
+ if (render_text_->GetTextDirection() == base::i18n::LEFT_TO_RIGHT)
+ MoveCursorRight(gfx::LINE_BREAK, false);
+ else
+ MoveCursorLeft(gfx::LINE_BREAK, false);
InsertText(text);
render_text_->SetCursorPosition(save);
ClearSelection();
@@ -338,7 +341,9 @@
}
if (GetText().length() > GetCursorPosition()) {
size_t cursor_position = GetCursorPosition();
- ExecuteAndRecordDelete(cursor_position, cursor_position + 1, true);
+ size_t next_grapheme_index =
+ render_text_->GetIndexOfNextGrapheme(cursor_position);
+ ExecuteAndRecordDelete(cursor_position, next_grapheme_index, true);
return true;
}
return false;
@@ -656,7 +661,7 @@
} else if (!HasSelection()) {
size_t cursor = GetCursorPosition();
gfx::SelectionModel sel(render_text_->selection_model());
- sel.set_selection_start(cursor + text.length());
+ sel.set_selection_start(render_text_->GetIndexOfNextGrapheme(cursor));
render_text_->MoveCursorTo(sel);
}
// Edit history is recorded in InsertText.

Powered by Google App Engine
This is Rietveld 408576698