MCPcopy Create free account
hub / github.com/AlexNisnevich/untrusted / inEditableArea

Function inEditableArea

scripts/codeEditor.js:156–173  ·  view source on GitHub ↗
(c)

Source from the content-addressed store, hash-verified

154 lastChange = change;
155
156 var inEditableArea = function(c) {
157 var lineNum = c.to.line;
158 if (editableLines.indexOf(lineNum) !== -1 && editableLines.indexOf(c.from.line) !== -1) {
159 // editable lines?
160 return true;
161 } else if (editableSections[lineNum]) {
162 // this line has editable sections - are we in one of them?
163 var sections = editableSections[lineNum];
164 for (var i = 0; i < sections.length; i++) {
165 var section = sections[i];
166 if (c.from.ch > section[0] && c.to.ch > section[0] &&
167 c.from.ch < section[1] && c.to.ch < section[1]) {
168 return true;
169 }
170 }
171 return false;
172 }
173 };
174
175 log(
176 '---Editor input (beforeChange) ---\n' +

Callers 1

enforceRestrictionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected