source: trip-planner-front/node_modules/inquirer/lib/utils/readline.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.2 KB
Line 
1'use strict';
2const ansiEscapes = require('ansi-escapes');
3
4/**
5 * Move cursor left by `x`
6 * @param {Readline} rl - Readline instance
7 * @param {Number} x - How far to go left (default to 1)
8 */
9
10exports.left = function (rl, x) {
11 rl.output.write(ansiEscapes.cursorBackward(x));
12};
13
14/**
15 * Move cursor right by `x`
16 * @param {Readline} rl - Readline instance
17 * @param {Number} x - How far to go left (default to 1)
18 */
19
20exports.right = function (rl, x) {
21 rl.output.write(ansiEscapes.cursorForward(x));
22};
23
24/**
25 * Move cursor up by `x`
26 * @param {Readline} rl - Readline instance
27 * @param {Number} x - How far to go up (default to 1)
28 */
29
30exports.up = function (rl, x) {
31 rl.output.write(ansiEscapes.cursorUp(x));
32};
33
34/**
35 * Move cursor down by `x`
36 * @param {Readline} rl - Readline instance
37 * @param {Number} x - How far to go down (default to 1)
38 */
39
40exports.down = function (rl, x) {
41 rl.output.write(ansiEscapes.cursorDown(x));
42};
43
44/**
45 * Clear current line
46 * @param {Readline} rl - Readline instance
47 * @param {Number} len - number of line to delete
48 */
49exports.clearLine = function (rl, len) {
50 rl.output.write(ansiEscapes.eraseLines(len));
51};
Note: See TracBrowser for help on using the repository browser.