diff --git a/core/ansi_prep.js b/core/ansi_prep.js index 29bd5ee4..45b93d32 100644 --- a/core/ansi_prep.js +++ b/core/ansi_prep.js @@ -23,6 +23,8 @@ module.exports = function ansiPrep(input, options, cb) { options.rows = options.rows || options.termHeight || 'auto'; options.startCol = options.startCol || 1; options.exportMode = options.exportMode || false; + options.fillLines = _.get(options, 'fillLines', true); + options.indent = options.indent || 0; // in auto we start out at 25 rows, but can always expand for more const canvas = Array.from( { length : 'auto' === options.rows ? 25 : options.rows }, () => Array.from( { length : options.cols}, () => new Object() ) ); @@ -111,15 +113,18 @@ module.exports = function ansiPrep(input, options, cb) { const lastCol = getLastPopulatedColumn(row) + 1; let i; - line = ''; + line = options.indent ? + output.length > 0 ? ' '.repeat(options.indent) : '' : + ''; + for(i = 0; i < lastCol; ++i) { const col = row[i]; - sgr = 0 === i ? + sgr = !options.asciiMode && 0 === i ? col.initialSgr ? ANSI.getSGRFromGraphicRendition(col.initialSgr) : '' : ''; - if(col.sgr) { + if(!options.asciiMode && col.sgr) { sgr += ANSI.getSGRFromGraphicRendition(col.sgr); } @@ -129,7 +134,10 @@ module.exports = function ansiPrep(input, options, cb) { output += line; if(i < row.length) { - output += `${ANSI.blackBG()}${row.slice(i).map( () => ' ').join('')}`;//${lastSgr}`; + output += `${options.asciiMode ? '' : ANSI.blackBG()}`; + if(options.fillLines) { + output += `${row.slice(i).map( () => ' ').join('')}`;//${lastSgr}`; + } } if(options.startCol + i < options.termWidth || options.forceLineTerm) { diff --git a/core/file_entry.js b/core/file_entry.js index b88d41a0..02912c35 100644 --- a/core/file_entry.js +++ b/core/file_entry.js @@ -520,6 +520,10 @@ module.exports = class FileEntry { sql += `${sqlWhere} ${sqlOrderBy};`; + if(_.isNumber(filter.limit)) { + sql += `LIMIT ${filter.limit}`; + } + const matchingFileIds = []; fileDb.each(sql, (err, fileId) => { if(fileId) {