Skip to content

Commit

Permalink
[sublime keymap] Fixing hotkeys for addCursorTo(Prev|Next)Line
Browse files Browse the repository at this point in the history
Fix for issue #5109
  • Loading branch information
tbertelsen authored and marijnh committed Dec 21, 2017
1 parent 9e36652 commit 40570dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 54 deletions.
33 changes: 4 additions & 29 deletions keymap/sublime.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,27 +514,6 @@
cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);
};

cmds.selectLinesUpward = function(cm) {
cm.operation(function() {
var ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i];
if (range.head.line > cm.firstLine())
cm.addSelection(Pos(range.head.line - 1, range.head.ch));
}
});
};
cmds.selectLinesDownward = function(cm) {
cm.operation(function() {
var ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i];
if (range.head.line < cm.lastLine())
cm.addSelection(Pos(range.head.line + 1, range.head.ch));
}
});
};

function getTarget(cm) {
var from = cm.getCursor("from"), to = cm.getCursor("to");
if (CodeMirror.cmpPos(from, to) == 0) {
Expand Down Expand Up @@ -596,8 +575,6 @@
"Cmd-Enter": "insertLineAfter",
"Shift-Cmd-Enter": "insertLineBefore",
"Cmd-D": "selectNextOccurrence",
"Shift-Cmd-Up": "addCursorToPrevLine",
"Shift-Cmd-Down": "addCursorToNextLine",
"Shift-Cmd-Space": "selectScope",
"Shift-Cmd-M": "selectBetweenBrackets",
"Cmd-M": "goToBracket",
Expand Down Expand Up @@ -627,8 +604,8 @@
"Cmd-K Cmd-Backspace": "delLineLeft",
"Cmd-K Cmd-0": "unfoldAll",
"Cmd-K Cmd-J": "unfoldAll",
"Ctrl-Shift-Up": "selectLinesUpward",
"Ctrl-Shift-Down": "selectLinesDownward",
"Ctrl-Shift-Up": "addCursorToPrevLine",
"Ctrl-Shift-Down": "addCursorToNextLine",
"Cmd-F3": "findUnder",
"Shift-Cmd-F3": "findUnderPrevious",
"Alt-F3": "findAllUnder",
Expand Down Expand Up @@ -658,8 +635,6 @@
"Ctrl-Enter": "insertLineAfter",
"Shift-Ctrl-Enter": "insertLineBefore",
"Ctrl-D": "selectNextOccurrence",
"Alt-CtrlUp": "addCursorToPrevLine",
"Alt-CtrlDown": "addCursorToNextLine",
"Shift-Ctrl-Space": "selectScope",
"Shift-Ctrl-M": "selectBetweenBrackets",
"Ctrl-M": "goToBracket",
Expand Down Expand Up @@ -689,8 +664,8 @@
"Ctrl-K Ctrl-Backspace": "delLineLeft",
"Ctrl-K Ctrl-0": "unfoldAll",
"Ctrl-K Ctrl-J": "unfoldAll",
"Ctrl-Alt-Up": "selectLinesUpward",
"Ctrl-Alt-Down": "selectLinesDownward",
"Ctrl-Alt-Up": "addCursorToPrevLine",
"Ctrl-Alt-Down": "addCursorToNextLine",
"Ctrl-F3": "findUnder",
"Shift-Ctrl-F3": "findUnderPrevious",
"Alt-F3": "findAllUnder",
Expand Down
25 changes: 0 additions & 25 deletions test/sublime_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,31 +221,6 @@
2, 4, 2, 6,
2, 7, 2, 7));

stTest("selectLinesUpward", "123\n345\n789\n012",
setSel(0, 1, 0, 1,
1, 1, 1, 3,
2, 0, 2, 0,
3, 0, 3, 0),
"selectLinesUpward",
hasSel(0, 1, 0, 1,
0, 3, 0, 3,
1, 0, 1, 0,
1, 1, 1, 3,
2, 0, 2, 0,
3, 0, 3, 0));

stTest("selectLinesDownward", "123\n345\n789\n012",
setSel(0, 1, 0, 1,
1, 1, 1, 3,
2, 0, 2, 0,
3, 0, 3, 0),
"selectLinesDownward",
hasSel(0, 1, 0, 1,
1, 1, 1, 3,
2, 0, 2, 0,
2, 3, 2, 3,
3, 0, 3, 0));

stTest("sortLines", "c\nb\na\nC\nB\nA",
"sortLines", val("A\nB\nC\na\nb\nc"),
"undo",
Expand Down

0 comments on commit 40570dd

Please sign in to comment.