MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / moveSel

Function moveSel

lib/web/CodeMirror/addon/edit/closebrackets.js:100–109  ·  view source on GitHub ↗
(cm, dir)

Source from the content-addressed store, hash-verified

98 }
99
100 function moveSel(cm, dir) {
101 var newRanges = [], ranges = cm.listSelections(), primary = 0
102 for (var i = 0; i < ranges.length; i++) {
103 var range = ranges[i]
104 if (range.head == cm.getCursor()) primary = i
105 var pos = {line: range.head.line, ch: range.head.ch + dir}
106 newRanges.push({anchor: pos, head: pos})
107 }
108 cm.setSelections(newRanges, primary)
109 }
110
111 function contractSelection(sel) {
112 var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;

Callers 2

handleEnterFunction · 0.85
handleCharFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected