| 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.
|
|
|