Bug 886474 - Stop using Ctrl + ] [ to match brackets in source editor, r=msucan

This commit is contained in:
Girish Sharma 2013-07-02 16:07:31 +05:30
parent 43eb2fc44a
commit 5d5c8e458d
3 changed files with 22 additions and 20 deletions

View File

@ -123,11 +123,13 @@ const DEFAULT_KEYBINDINGS = [
action: "Move to Bracket Opening",
code: Ci.nsIDOMKeyEvent.DOM_VK_OPEN_BRACKET,
accel: true,
alt: true,
},
{
action: "Move to Bracket Closing",
code: Ci.nsIDOMKeyEvent.DOM_VK_CLOSE_BRACKET,
accel: true,
alt: true,
},
];

View File

@ -53,33 +53,33 @@ function test() {
// Setting caret at Line 1 bracket start.
editor.setCaretOffset(19);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 220,
"JS : Jump to closing bracket of the code block when caret at block start");
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 20,
"JS : Jump to opening bracket of the code block when caret at block end");
// Setting caret at Line 10 start.
editor.setCaretOffset(161);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 20,
"JS : Jump to opening bracket of code block when inside the function");
editor.setCaretOffset(161);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 220,
"JS : Jump to closing bracket of code block when inside the function");
// Setting caret at Line 6 start.
editor.setCaretOffset(67);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 159,
"JS : Jump to closing bracket in a nested function with caret inside");
editor.setCaretOffset(67);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 62,
"JS : Jump to opening bracket in a nested function with caret inside");
@ -93,22 +93,22 @@ function test() {
// Setting caret at Line 1 bracket start.
editor.setCaretOffset(8);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 45,
"CSS : Jump to closing bracket of the code block when caret at block start");
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 9,
"CSS : Jump to opening bracket of the code block when caret at block end");
// Setting caret at Line 3 start.
editor.setCaretOffset(28);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 9,
"CSS : Jump to opening bracket of code block when inside the function");
editor.setCaretOffset(28);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 45,
"CSS : Jump to closing bracket of code block when inside the function");
@ -124,13 +124,13 @@ function test() {
// Setting caret at Line 1 end.
editor.setCaretOffset(6);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 6,
"HTML : Jump to block end : Nothing happens in html mode");
// Setting caret at Line 4 end.
editor.setCaretOffset(64);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 64,
"HTML : Jump to block start : Nothing happens in html mode");
@ -144,13 +144,13 @@ function test() {
// Setting caret at Line 1 start.
editor.setCaretOffset(0);
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 0,
"Text : Jump to block end : Nothing happens in text mode");
// Setting caret at Line 4 end.
editor.setCaretOffset(28);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 28,
"Text : Jump to block start : Nothing happens in text mode");

View File

@ -57,15 +57,15 @@ function test() {
// Setting caret at end of line 11 (function baz() {).
editor.setCaretOffset(147);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 16,
"JS : Jump to opening bracket of previous sibling block when no parent");
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 129,
"JS : Jump to closing bracket of same code block");
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 151,
"JS : Jump to closing bracket of next sibling code block");
@ -82,15 +82,15 @@ function test() {
// Setting caret at Line 5 end (.class1 {).
editor.setCaretOffset(57);
EventUtils.synthesizeKey("[", {accelKey: true}, testWin);
EventUtils.synthesizeKey("[", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 10,
"CSS : Jump to opening bracket of previous sibling code block");
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 46,
"CSS : Jump to closing bracket of same code block");
EventUtils.synthesizeKey("]", {accelKey: true}, testWin);
EventUtils.synthesizeKey("]", {accelKey: true, altKey: true}, testWin);
is(editor.getCaretOffset(), 77,
"CSS : Jump to closing bracket of next sibling code block");