Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var stripInput = function (prevPosition, cm, string) {
var endPosition = { ch: Infinity, line: Infinity };
var text = cm.doc.getRange(prevPosition, endPosition);
// Remove everything after the position
cm.doc.replaceRange('', prevPosition, endPosition);
// Trim and/or remove the last line if it is now empty
var lastLine = trim.right(cm.doc.getLine(cm.doc.lastLine()));
if (lastLine) {
cm.doc.setLine(cm.doc.lastLine(), lastLine);
} else {
cm.doc.removeLine(cm.doc.lastLine());
}
return trim.left(text.substr(string.length));
};