Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function adjustCellFoldRange(editor: atom$TextEditor, range: atom$Range) {
const startRow = range.start.row > 0 ? range.start.row - 1 : 0;
const startWidth = editor.lineTextForBufferRow(startRow).length;
const endRow =
range.end.row == editor.getLastBufferRow()
? range.end.row
: range.end.row - 1;
return new Range(
new Point(startRow, startWidth),
new Point(endRow, range.end.column)
);
}
function getEOL(document: Atom.TextEditor): string {
let text = document.getText();
if (document.getLineCount() > 1) {
let to = document.getBuffer().characterIndexForPosition(new Point(1, 0));
let from = to;
while (from > 0 && isEOL(text, from - 1)) {
from--;
}
return text.substr(from, to - from);
}
return '\n';
}
function getEOL(document) {
var text = document.getText();
if (document.getLineCount() > 1) {
var to = document.getBuffer().characterIndexForPosition(new _atom.Point(1, 0));
var from = to;
while (from > 0 && isEOL(text, from - 1)) {
from--;
}
return text.substr(from, to - from);
}
return '\n';
}
function isEOL(text, offset) {
function range(startLine, startColumn, endLine, endColumn) {
return new Range(
new Point(startLine, startColumn),
new Point(endLine, endColumn),
);
}
function range(startLine, startColumn, endLine, endColumn) {
return new Range(
new Point(startLine, startColumn),
new Point(endLine, endColumn),
);
}