Sha256: 65ca15c22a7d6417da70d452158af67b4b2523bb70daf6a3bbd9738ca3ba15d0

Contents?: true

Size: 1.44 KB

Versions: 62

Compression:

Stored size: 1.44 KB

Contents

'use strict';
var ESC = '\u001b[';
var x = module.exports;

x.cursorTo = function (x, y) {
	if (arguments.length === 0) {
		return ESC + 'H';
	}

	if (arguments.length === 1) {
		return ESC + (x + 1) + 'G';
	}

	return ESC + (y + 1) + ';' + (x + 1) + 'H';
};

x.cursorMove = function (x, y) {
	var ret = '';

	if (x < 0) {
		ret += ESC + (-x) + 'D';
	} else if (x > 0) {
		ret += ESC + x + 'C';
	}

	if (y < 0) {
		ret += ESC + (-y) + 'A';
	} else if (y > 0) {
		ret += ESC + y + 'B';
	}

	return ret;
};

x.cursorUp = function (count) {
	return ESC + (count || 1) + 'A';
};

x.cursorDown = function (count) {
	return ESC + (count || 1) + 'B';
};

x.cursorForward = function (count) {
	return ESC + (count || 1) + 'C';
};

x.cursorBackward = function (count) {
	return ESC + (count || 1) + 'D';
};

x.cursorLeft = ESC + '1000D';
x.cursorSavePosition = ESC + 's';
x.cursorRestorePosition = ESC + 'u';
x.cursorGetPosition = ESC + '6n';
x.cursorNextLine = ESC + 'E';
x.cursorPrevLine = ESC + 'F';
x.cursorHide = ESC + '?25l';
x.cursorShow = ESC + '?25h';

x.eraseLines = function (count) {
	var clear = '';

	for (var i = 0; i < count; i++) {
		clear += x.cursorLeft + x.eraseEndLine + (i < count - 1 ? x.cursorUp() : '');
	}

	return clear;
};

x.eraseEndLine = ESC + 'K';
x.eraseStartLine = ESC + '1K';
x.eraseLine = ESC + '2K';
x.eraseDown = ESC + 'J';
x.eraseUp = ESC + '1J';
x.eraseScreen = ESC + '2J';
x.scrollUp = ESC + 'S';
x.scrollDown = ESC + 'T';

x.beep = '\u0007';

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/inquirer/node_modules/ansi-escapes/index.js