Skip to content

Commit 40570dd

Browse files
tbertelsenmarijnh
authored andcommitted
[sublime keymap] Fixing hotkeys for addCursorTo(Prev|Next)Line
Fix for issue codemirror#5109
1 parent 9e36652 commit 40570dd

File tree

2 files changed

+4
-54
lines changed

2 files changed

+4
-54
lines changed

keymap/sublime.js

+4-29
Original file line numberDiff line numberDiff line change
@@ -514,27 +514,6 @@
514514
cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);
515515
};
516516

517-
cmds.selectLinesUpward = function(cm) {
518-
cm.operation(function() {
519-
var ranges = cm.listSelections();
520-
for (var i = 0; i < ranges.length; i++) {
521-
var range = ranges[i];
522-
if (range.head.line > cm.firstLine())
523-
cm.addSelection(Pos(range.head.line - 1, range.head.ch));
524-
}
525-
});
526-
};
527-
cmds.selectLinesDownward = function(cm) {
528-
cm.operation(function() {
529-
var ranges = cm.listSelections();
530-
for (var i = 0; i < ranges.length; i++) {
531-
var range = ranges[i];
532-
if (range.head.line < cm.lastLine())
533-
cm.addSelection(Pos(range.head.line + 1, range.head.ch));
534-
}
535-
});
536-
};
537-
538517
function getTarget(cm) {
539518
var from = cm.getCursor("from"), to = cm.getCursor("to");
540519
if (CodeMirror.cmpPos(from, to) == 0) {
@@ -596,8 +575,6 @@
596575
"Cmd-Enter": "insertLineAfter",
597576
"Shift-Cmd-Enter": "insertLineBefore",
598577
"Cmd-D": "selectNextOccurrence",
599-
"Shift-Cmd-Up": "addCursorToPrevLine",
600-
"Shift-Cmd-Down": "addCursorToNextLine",
601578
"Shift-Cmd-Space": "selectScope",
602579
"Shift-Cmd-M": "selectBetweenBrackets",
603580
"Cmd-M": "goToBracket",
@@ -627,8 +604,8 @@
627604
"Cmd-K Cmd-Backspace": "delLineLeft",
628605
"Cmd-K Cmd-0": "unfoldAll",
629606
"Cmd-K Cmd-J": "unfoldAll",
630-
"Ctrl-Shift-Up": "selectLinesUpward",
631-
"Ctrl-Shift-Down": "selectLinesDownward",
607+
"Ctrl-Shift-Up": "addCursorToPrevLine",
608+
"Ctrl-Shift-Down": "addCursorToNextLine",
632609
"Cmd-F3": "findUnder",
633610
"Shift-Cmd-F3": "findUnderPrevious",
634611
"Alt-F3": "findAllUnder",
@@ -658,8 +635,6 @@
658635
"Ctrl-Enter": "insertLineAfter",
659636
"Shift-Ctrl-Enter": "insertLineBefore",
660637
"Ctrl-D": "selectNextOccurrence",
661-
"Alt-CtrlUp": "addCursorToPrevLine",
662-
"Alt-CtrlDown": "addCursorToNextLine",
663638
"Shift-Ctrl-Space": "selectScope",
664639
"Shift-Ctrl-M": "selectBetweenBrackets",
665640
"Ctrl-M": "goToBracket",
@@ -689,8 +664,8 @@
689664
"Ctrl-K Ctrl-Backspace": "delLineLeft",
690665
"Ctrl-K Ctrl-0": "unfoldAll",
691666
"Ctrl-K Ctrl-J": "unfoldAll",
692-
"Ctrl-Alt-Up": "selectLinesUpward",
693-
"Ctrl-Alt-Down": "selectLinesDownward",
667+
"Ctrl-Alt-Up": "addCursorToPrevLine",
668+
"Ctrl-Alt-Down": "addCursorToNextLine",
694669
"Ctrl-F3": "findUnder",
695670
"Shift-Ctrl-F3": "findUnderPrevious",
696671
"Alt-F3": "findAllUnder",

test/sublime_test.js

-25
Original file line numberDiff line numberDiff line change
@@ -221,31 +221,6 @@
221221
2, 4, 2, 6,
222222
2, 7, 2, 7));
223223

224-
stTest("selectLinesUpward", "123\n345\n789\n012",
225-
setSel(0, 1, 0, 1,
226-
1, 1, 1, 3,
227-
2, 0, 2, 0,
228-
3, 0, 3, 0),
229-
"selectLinesUpward",
230-
hasSel(0, 1, 0, 1,
231-
0, 3, 0, 3,
232-
1, 0, 1, 0,
233-
1, 1, 1, 3,
234-
2, 0, 2, 0,
235-
3, 0, 3, 0));
236-
237-
stTest("selectLinesDownward", "123\n345\n789\n012",
238-
setSel(0, 1, 0, 1,
239-
1, 1, 1, 3,
240-
2, 0, 2, 0,
241-
3, 0, 3, 0),
242-
"selectLinesDownward",
243-
hasSel(0, 1, 0, 1,
244-
1, 1, 1, 3,
245-
2, 0, 2, 0,
246-
2, 3, 2, 3,
247-
3, 0, 3, 0));
248-
249224
stTest("sortLines", "c\nb\na\nC\nB\nA",
250225
"sortLines", val("A\nB\nC\na\nb\nc"),
251226
"undo",

0 commit comments

Comments
 (0)