Bug 859088 - Left/Right Arrow key after selection should move to the beginning/end of selection respectively (on all platforms). r=ehsan

This commit is contained in:
Mats Palmgren 2013-04-17 22:16:14 +02:00
Родитель db4a38d7ac
Коммит fece027364
3 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -784,13 +784,11 @@ nsFrameSelection::MoveCaret(uint32_t aKeycode,
SetDesiredX(desiredX);
}
int32_t caretStyle =
Preferences::GetInt("layout.selection.caret_style", 0);
#ifdef XP_MACOSX
int32_t caretStyle = Preferences::GetInt("layout.selection.caret_style", 0);
if (caretStyle == 0) {
caretStyle = 2; // put caret at the selection edge in the |aKeycode| direction
// Put caret at the selection edge in the |aKeycode| direction.
caretStyle = 2;
}
#endif
if (!isCollapsed && !aContinueSelection && caretStyle == 2) {
switch (aKeycode){

Просмотреть файл

@ -1683,11 +1683,12 @@ pref("layout.word_select.stop_at_punctuation", true);
// controls caret style and word-delete during text selection
// 0 = use platform default
// 1 = caret moves and blinks as when there is no selection; word
// delete deselects the selection and then deletes word (Windows default)
// delete deselects the selection and then deletes word
// 2 = caret moves to selection edge and is not visible during selection;
// word delete deletes the selection (Mac default)
// word delete deletes the selection (Mac and Linux default)
// 3 = caret moves and blinks as when there is no selection; word delete
// deletes the selection (Unix default)
// deletes the selection
// Windows default is 1 for word delete behavior, the rest as for 2.
pref("layout.selection.caret_style", 0);
// pref to control whether or not to replace backslashes with Yen signs

Просмотреть файл

@ -48,6 +48,16 @@
gBrowser.loadURI(data);
}
function goToStartOfLine(aElement) {
if (navigator.platform.indexOf("Mac") >= 0) {
synthesizeKey(aElement, true, KeyEvent.DOM_VK_LEFT,
false, false, true);
} else {
synthesizeKey(aElement, true, KeyEvent.DOM_VK_HOME,
false, false, false);
}
}
function resetForNextTest(aElement, aText) {
if (!aText)
aText = SEARCH_TEXT;
@ -67,10 +77,7 @@
// Move caret to start of element
aElement.focus();
synthesizeKey(aElement, true, KeyEvent.DOM_VK_UP,
sendCtrl, false, sendMeta);
synthesizeKey(aElement, true, KeyEvent.DOM_VK_LEFT,
sendCtrl, false, sendMeta);
goToStartOfLine(aElement);
}
function synthesizeKey(target, isKeyCode, key, ctlKey, shiftKey, metaKey) {