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

Unified Diff: ui/gfx/render_text.cc

Issue 13972015: Select last word when double clicked after the last character (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 2 Created 7 years, 8 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
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text.cc
diff --git a/ui/gfx/render_text.cc b/ui/gfx/render_text.cc
index fc9353f682f79ae48a19638650539c8275a629cd..7d55f0cee0134e849058f58786a6dee29d6564bf 100644
--- a/ui/gfx/render_text.cc
+++ b/ui/gfx/render_text.cc
@@ -475,6 +475,9 @@ void RenderText::SelectWord() {
return;
size_t selection_start = cursor_pos;
+ if (selection_start == text().length() && selection_start != 0)
+ --selection_start;
+
for (; selection_start != 0; --selection_start) {
if (iter.IsStartOfWord(selection_start) ||
iter.IsEndOfWord(selection_start))
« no previous file with comments | « no previous file | ui/gfx/render_text_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698