Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Editor.prototype.visiblePos = function (pos) {
var self = this;
if (pos instanceof Range) return new Range(self.visiblePos(pos.start), self.visiblePos(pos.end));
pos = Point.fromObject(pos, true);
pos.column = self.lineWithEndingForRow(pos.row)
.slice(0, Math.max(pos.column, 0))
.replace(Editor._tabRegExp, _.repeat('\t', self.buffer.options.tabSize).join(''))
.length;
return pos;
};
Editor.prototype.realPos = function (pos) {
Editor.prototype.realPos = function (pos) {
var self = this;
if (pos instanceof Range) return new Range(self.realPos(pos.start), self.realPos(pos.end));
pos = self.textBuf.clipPosition(Point.fromObject(pos, true));
pos.column = this.lineWithEndingForRow(pos.row)
.replace(Editor._tabRegExp, _.repeat('\t', this.buffer.options.tabSize).join(''))
.slice(0, Math.max(pos.column, 0))
.replace(new RegExp('\\t{1,'+this.buffer.options.tabSize+'}', 'g'), '\t')
.length;
return pos;
};