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

Unified Diff: ui/gfx/text_constants.h

Issue 1989143002: MacViews: Correct behavior of move and select commands when selection direction changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_commands
Patch Set: Address review comments. Created 4 years, 7 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 93450ea56070d6957379e15733ac24ab14c2d131..1bf48ec05fbacf3b6f295b3660d29a1d86b12eb2 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 {
+ // Existing selection is deselcted 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).
tapted 2016/05/25 04:31:06 Is there a rule we can follow for these without ha
karandeepb 2016/05/25 05:04:11 Yes SELECTION_CARET can be inferred from WORD_BREA
+ SELECTION_CARET,
+
+ 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:
« ui/gfx/render_text.cc ('K') | « ui/gfx/render_text.cc ('k') | ui/strings/ui_strings.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698