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

Unified Diff: ui/gfx/text_constants.h

Issue 2228833002: MacViews: Fix behavior of move and select commands when selection direction changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@use_text_commands
Patch Set: Created 4 years, 4 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: ui/gfx/text_constants.h
diff --git a/ui/gfx/text_constants.h b/ui/gfx/text_constants.h
index b09081dd8a0b51fd955f319e665a2ced94634503..51e72652e4d190c40609e4bbfda9fcb610e9e1a4 100644
--- a/ui/gfx/text_constants.h
+++ b/ui/gfx/text_constants.h
@@ -15,6 +15,34 @@ enum BreakType {
LINE_BREAK, // Stop cursor movement on line ends as shown on screen.
};
+// Specifies how a move and select command behaves if the selection direction
+// is reversed. For example consider the state "ab|cd|e", i.e. cd is selected.
+// Assume the selection direction is from left to right. If we move to the
+// beginning of the line while modifying the selection, the resultant state is:
+// "|ab|cde" for SELECTION_START_NEW, selection direction from right to left.
+// "|abcd|e" for SELECTION_EXTEND, selection direction from right to left.
+// "ab|cde" for SELECTION_CARET.
+enum SelectionReversedBehavior {
tapted 2016/08/11 03:44:07 What about calling this just `SelectionBehavior` a
karandeepb 2016/08/16 10:24:52 Nice suggestion. Done.
+ // Existing selection is deselected and a new selection is started in the
+ // opposite direction. Default. For example, this is the behavior of
+ // textfields on Mac for the command moveUpAndModifySelection (Shift + Up).
+ // Also this is the default behavior for text editing commands on Linux and
+ // Windows.
+ SELECTION_START_NEW,
+
+ // The existing selection is extended in the opposite direction. For example,
+ // this is the behavior for textfields on Mac for the command
+ // moveToLeftEndOfLineAndModifySelection (Command + Shift + Left).
+ SELECTION_EXTEND,
+
+ // The existing selection reduces to a caret. For example, this is the
+ // behavior for textfields on Mac for the command
+ // moveWordLeftAndModifySelection (Alt + Shift + Left).
+ SELECTION_CARET,
msw 2016/08/11 23:46:37 Why do we need explicit behavior for this? The exi
tapted 2016/08/12 00:12:00 Yeah this tripped me up too :). Karan can probably
karandeepb 2016/08/12 01:26:31 No we don't. As Trent said, this only comes into p
msw 2016/08/12 21:58:30 Ah, we need tests for this like TextfieldTest.Cont
karandeepb 2016/08/16 10:24:52 Added tests. Was planning to add them after the in
+
+ SELECTION_DEFAULT = SELECTION_START_NEW,
+};
+
// Specifies the word wrapping behavior when a word would exceed the available
// display width. All words that are too wide will be put on a new line, and
// then:

Powered by Google App Engine
This is Rietveld 408576698