How to use the lazy.js.repeat function in lazy

To help you get started, we’ve selected a few lazy examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github slap-editor / slap / lib / ui / Editor.js View on Github external
});

    if (cursorOnBracket && row === visibleCursor.row) {
      line = markup(line, bracketStyle,
        visibleCursor.column - column,
        visibleCursor.column - column + 1);
    }
    if (visibleMatchingBracket && row === visibleMatchingBracket.row) {
      line = markup(line, bracketStyle,
        visibleMatchingBracket.column - column,
        visibleMatchingBracket.column - column + 1);
    }

    bufferContent.push(line + '{/}');

    var gutterLine = (_.repeat(' ', lineNumberWidth).join('') + (row + 1)).slice(-lineNumberWidth);
    gutterLine += _.repeat(' ', gutterWidth).join('');

    if (currentLineStyle && row === visibleCursor.row) {
      gutterLine = markup(gutterLine, currentLineStyle);
    }

    gutterContent.push(gutterLine + '{/}');
  });
github slap-editor / slap / lib / ui / Editor.js View on Github external
Editor.prototype._renderableTabString = function (match) {
  return !this.buffer.options.visibleWhiteSpace
    ? _.repeat(' ', this.buffer.options.tabSize * match.length).join('')
    : markup(_.repeat(
        _.repeat('\u2500', this.buffer.options.tabSize - 1).join('') +
        (this.buffer.options.tabSize ? '\u2574' : '')
      , match.length).join(''), this.options.style.whiteSpace)
};
Editor.prototype._renderableSpace = function (match) {
github slap-editor / slap / lib / ui / Editor.js View on Github external
Editor.prototype._renderableSpace = function (match) {
  return !this.buffer.options.visibleWhiteSpace
    ? match
    : markup(_.repeat('\u00b7', match.length).join(''), this.options.style.whiteSpace);
};
Editor.prototype._renderableLineEnding = function (lineEnding) {
github slap-editor / slap / lib / slap.js View on Github external
content: prompts.map(function (prompt) {
          return markup(
            (' ' + prompt + ':' + _.repeat(' ', labelWidth).join('')).slice(0, labelWidth),
          self.options.style.prompt || self.options.style.main);
        }).join('\n'),
        top: 0,
github slap-editor / slap / lib / ui / Editor.js View on Github external
Editor.prototype._getTabString = function () {
  var self = this;
  return self.buffer.options.useSpaces
    ? _.repeat(' ', self.buffer.options.tabSize).join('')
    : '\t';
};
Editor.prototype.indent = function (range, dedent) {
github slap-editor / slap / lib / ui / Editor.js View on Github external
Editor.prototype._renderableTabString = function (match) {
  return !this.buffer.options.visibleWhiteSpace
    ? _.repeat(' ', this.buffer.options.tabSize * match.length).join('')
    : markup(_.repeat(
        _.repeat('\u2500', this.buffer.options.tabSize - 1).join('') +
        (this.buffer.options.tabSize ? '\u2574' : '')
      , match.length).join(''), this.options.style.whiteSpace)
};
Editor.prototype._renderableSpace = function (match) {
github slap-editor / slap / lib / ui / Editor.js View on Github external
Editor.prototype._renderableTabString = function (match) {
  return !this.buffer.options.visibleWhiteSpace
    ? _.repeat(' ', this.buffer.options.tabSize * match.length).join('')
    : markup(_.repeat(
        _.repeat('\u2500', this.buffer.options.tabSize - 1).join('') +
        (this.buffer.options.tabSize ? '\u2574' : '')
      , match.length).join(''), this.options.style.whiteSpace)
};
Editor.prototype._renderableSpace = function (match) {
github slap-editor / slap / lib / ui / Editor.js View on Github external
if (cursorOnBracket && row === visibleCursor.row) {
      line = markup(line, bracketStyle,
        visibleCursor.column - column,
        visibleCursor.column - column + 1);
    }
    if (visibleMatchingBracket && row === visibleMatchingBracket.row) {
      line = markup(line, bracketStyle,
        visibleMatchingBracket.column - column,
        visibleMatchingBracket.column - column + 1);
    }

    bufferContent.push(line + '{/}');

    var gutterLine = (_.repeat(' ', lineNumberWidth).join('') + (row + 1)).slice(-lineNumberWidth);
    gutterLine += _.repeat(' ', gutterWidth).join('');

    if (currentLineStyle && row === visibleCursor.row) {
      gutterLine = markup(gutterLine, currentLineStyle);
    }

    gutterContent.push(gutterLine + '{/}');
  });
github slap-editor / slap / lib / slap.js View on Github external
markupPath = markup(markupPath+'*', style.changed);
  }
  left += markupPath;

  var right = [(cursor.y+1)+','+(cursor.x+1) + ' ('+self.editor.lines().length+')'];
  if (!self.insertMode()) right.unshift(markup('OVR', '{red-bg}{white-fg}'));
  var message = self.message();
  if (message) {
    if (self._blink()) message = markup(message, style.blink);
    right.unshift(message);
  }
  right = right.join('  ') + ' ';

  var remainingWidth = self.header.width - self.header.iwidth - markup.strip(left + right).length;
  self.header.setContent(markup(
    left + _.repeat(' ', remainingWidth).join('') + right
  , style.header || style.main));

  return blessed.Screen.prototype.render.apply(self, arguments);
};
github slap-editor / slap / lib / ui / Editor.js View on Github external
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;
};

lazy

Lazy lists for node

MIT
Latest version published 11 years ago

Package Health Score

67 / 100
Full package analysis