add scrollIntoView to all commands

This commit is contained in:
nightwing 2014-01-30 20:46:47 +04:00
commit ca41480c72

View file

@ -60,7 +60,7 @@ exports.commands = [{
module.showErrorMarker(editor, 1); module.showErrorMarker(editor, 1);
}); });
}, },
scrollIntoView: "center", scrollIntoView: "animate",
readOnly: true readOnly: true
}, { }, {
name: "goToPreviousError", name: "goToPreviousError",
@ -70,7 +70,7 @@ exports.commands = [{
module.showErrorMarker(editor, -1); module.showErrorMarker(editor, -1);
}); });
}, },
scrollIntoView: "center", scrollIntoView: "animate",
readOnly: true readOnly: true
}, { }, {
name: "selectall", name: "selectall",
@ -366,12 +366,14 @@ exports.commands = [{
bindKey: "Shift-Home", bindKey: "Shift-Home",
exec: function(editor) { editor.getSelection().selectLineStart(); }, exec: function(editor) { editor.getSelection().selectLineStart(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true readOnly: true
}, { }, {
name: "selectlineend", name: "selectlineend",
bindKey: "Shift-End", bindKey: "Shift-End",
exec: function(editor) { editor.getSelection().selectLineEnd(); }, exec: function(editor) { editor.getSelection().selectLineEnd(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
scrollIntoView: "cursor",
readOnly: true readOnly: true
}, { }, {
name: "togglerecording", name: "togglerecording",
@ -409,21 +411,25 @@ exports.commands = [{
editor.clearSelection(); editor.clearSelection();
} }
}, },
scrollIntoView: "cursor",
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, { }, {
name: "removeline", name: "removeline",
bindKey: bindKey("Ctrl-D", "Command-D"), bindKey: bindKey("Ctrl-D", "Command-D"),
exec: function(editor) { editor.removeLines(); }, exec: function(editor) { editor.removeLines(); },
scrollIntoView: "cursor",
multiSelectAction: "forEachLine" multiSelectAction: "forEachLine"
}, { }, {
name: "duplicateSelection", name: "duplicateSelection",
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); }, exec: function(editor) { editor.duplicateSelection(); },
scrollIntoView: "cursor",
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, { }, {
name: "sortlines", name: "sortlines",
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"), bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
exec: function(editor) { editor.sortLines(); }, exec: function(editor) { editor.sortLines(); },
scrollIntoView: "selection",
multiSelectAction: "forEachLine" multiSelectAction: "forEachLine"
}, { }, {
name: "togglecomment", name: "togglecomment",
@ -435,7 +441,8 @@ exports.commands = [{
name: "toggleBlockComment", name: "toggleBlockComment",
bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"), bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"),
exec: function(editor) { editor.toggleBlockComment(); }, exec: function(editor) { editor.toggleBlockComment(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "selectionPart"
}, { }, {
name: "modifyNumberUp", name: "modifyNumberUp",
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
@ -463,24 +470,29 @@ exports.commands = [{
}, { }, {
name: "copylinesup", name: "copylinesup",
bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"), bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
exec: function(editor) { editor.copyLinesUp(); } exec: function(editor) { editor.copyLinesUp(); },
scrollIntoView: "cursor"
}, { }, {
name: "movelinesup", name: "movelinesup",
bindKey: bindKey("Alt-Up", "Option-Up"), bindKey: bindKey("Alt-Up", "Option-Up"),
exec: function(editor) { editor.moveLinesUp(); } exec: function(editor) { editor.moveLinesUp(); },
scrollIntoView: "cursor"
}, { }, {
name: "copylinesdown", name: "copylinesdown",
bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"), bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
exec: function(editor) { editor.copyLinesDown(); } exec: function(editor) { editor.copyLinesDown(); },
scrollIntoView: "cursor"
}, { }, {
name: "movelinesdown", name: "movelinesdown",
bindKey: bindKey("Alt-Down", "Option-Down"), bindKey: bindKey("Alt-Down", "Option-Down"),
exec: function(editor) { editor.moveLinesDown(); } exec: function(editor) { editor.moveLinesDown(); },
scrollIntoView: "cursor"
}, { }, {
name: "del", name: "del",
bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"), bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"),
exec: function(editor) { editor.remove("right"); }, exec: function(editor) { editor.remove("right"); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "backspace", name: "backspace",
bindKey: bindKey( bindKey: bindKey(
@ -488,7 +500,8 @@ exports.commands = [{
"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H" "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"
), ),
exec: function(editor) { editor.remove("left"); }, exec: function(editor) { editor.remove("left"); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "cut_or_delete", name: "cut_or_delete",
bindKey: bindKey("Shift-Delete", null), bindKey: bindKey("Shift-Delete", null),
@ -499,27 +512,32 @@ exports.commands = [{
return false; return false;
} }
}, },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removetolinestart", name: "removetolinestart",
bindKey: bindKey("Alt-Backspace", "Command-Backspace"), bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
exec: function(editor) { editor.removeToLineStart(); }, exec: function(editor) { editor.removeToLineStart(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removetolineend", name: "removetolineend",
bindKey: bindKey("Alt-Delete", "Ctrl-K"), bindKey: bindKey("Alt-Delete", "Ctrl-K"),
exec: function(editor) { editor.removeToLineEnd(); }, exec: function(editor) { editor.removeToLineEnd(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removewordleft", name: "removewordleft",
bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"), bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
exec: function(editor) { editor.removeWordLeft(); }, exec: function(editor) { editor.removeWordLeft(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "removewordright", name: "removewordright",
bindKey: bindKey("Ctrl-Delete", "Alt-Delete"), bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
exec: function(editor) { editor.removeWordRight(); }, exec: function(editor) { editor.removeWordRight(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "outdent", name: "outdent",
bindKey: bindKey("Shift-Tab", "Shift-Tab"), bindKey: bindKey("Shift-Tab", "Shift-Tab"),
@ -554,27 +572,32 @@ exports.commands = [{
exec: function(editor, args) { exec: function(editor, args) {
editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
}, },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "splitline", name: "splitline",
bindKey: bindKey(null, "Ctrl-O"), bindKey: bindKey(null, "Ctrl-O"),
exec: function(editor) { editor.splitLine(); }, exec: function(editor) { editor.splitLine(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "transposeletters", name: "transposeletters",
bindKey: bindKey("Ctrl-T", "Ctrl-T"), bindKey: bindKey("Ctrl-T", "Ctrl-T"),
exec: function(editor) { editor.transposeLetters(); }, exec: function(editor) { editor.transposeLetters(); },
multiSelectAction: function(editor) {editor.transposeSelections(1); } multiSelectAction: function(editor) {editor.transposeSelections(1); },
scrollIntoView: "cursor"
}, { }, {
name: "touppercase", name: "touppercase",
bindKey: bindKey("Ctrl-U", "Ctrl-U"), bindKey: bindKey("Ctrl-U", "Ctrl-U"),
exec: function(editor) { editor.toUpperCase(); }, exec: function(editor) { editor.toUpperCase(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}, { }, {
name: "tolowercase", name: "tolowercase",
bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"), bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
exec: function(editor) { editor.toLowerCase(); }, exec: function(editor) { editor.toLowerCase(); },
multiSelectAction: "forEach" multiSelectAction: "forEach",
scrollIntoView: "cursor"
}]; }];
}); });