Socket
Socket
Sign inDemoInstall

readline-ui

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

readline-ui - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

46

index.js

@@ -46,4 +46,4 @@ 'use strict';

this.force = this.forceClose.bind(this);
this.input.on('keypress', this.onKeypress.bind(this, this));
this.on('keypress', this.onKeypress.bind(this, this));
this.onKeypress = this.onKeypress.bind(this);
this.input.on('keypress', this.onKeypress);
this.rl.resume();

@@ -56,12 +56,11 @@ this.rl.on('line', this.emit.bind(this, 'line'));

/**
* Close the interface when the keypress is `^C`
* Emit keypress events
*/
UI.prototype.onKeypress = function(app, str, key) {
var event = utils.normalize(str, key);
if (event) {
app.emit('keypress', event);
if (event.key.name) {
app.emit(event.key.name, event);
}
UI.prototype.onKeypress = function(str, key) {
var events = utils.normalize(str, key);
for (var i = 0; i < events.length; i++) {
var event = events[i];
this.emit('keypress', event.key.name, event.key);
this.emit(event.key.name, event.key);
}

@@ -87,3 +86,3 @@ };

var promptLine = utils.lastLine(str);
var rawPromptLine = stripColor(promptLine);
var rawPromptLine = this.unstyle(promptLine);

@@ -131,6 +130,8 @@ // Remove the last line from our prompt. We can't rely on the str of

// Reset cursor at the beginning of the line
utils.left(this.rl, stringWidth(utils.lastLine(fullContent)));
var lastLine = utils.lastLine(fullContent);
utils.left(this.rl, stringWidth(lastLine));
// Adjust cursor on the right
utils.right(this.rl, cursorPos.cols);
var newPos = this.unstyle(lastLine).length;
utils.right(this.rl, newPos);

@@ -231,5 +232,24 @@ // Set up state for next re-rendering

this.rl.output.write(linefeed !== false ? '\n' : '');
utils.cursorShow(this.rl);
};
/**
* Convenience method for debugging
*/
UI.prototype.log = function() {
console.log(Array(10).join('\n'));
console.log.apply(console, arguments);
console.log(Array(10).join('\n'));
};
/**
* Convenience method for debugging
*/
UI.prototype.unstyle = function(str) {
return stripColor(str);
};
/**
* Expose `UI`

@@ -236,0 +256,0 @@ */

{
"name": "readline-ui",
"description": "Create readline interface to use in prompts.",
"version": "1.0.0",
"version": "2.0.0",
"homepage": "https://github.com/enquirer/readline-ui",

@@ -74,3 +74,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"enquirer",
"enquirer-question",
"prompt-question",
"prompt-choices",

@@ -77,0 +77,0 @@ "readline-utils"

@@ -22,3 +22,3 @@ # readline-ui [![NPM version](https://img.shields.io/npm/v/readline-ui.svg?style=flat)](https://www.npmjs.com/package/readline-ui) [![NPM monthly downloads](https://img.shields.io/npm/dm/readline-ui.svg?style=flat)](https://npmjs.org/package/readline-ui) [![NPM total downloads](https://img.shields.io/npm/dt/readline-ui.svg?style=flat)](https://npmjs.org/package/readline-ui) [![Linux Build Status](https://img.shields.io/travis/enquirer/readline-ui.svg?style=flat&label=Travis)](https://travis-ci.org/enquirer/readline-ui)

### [.render](index.js#L76)
### [.render](index.js#L75)

@@ -33,3 +33,3 @@ Render the given `str` in the terminal, and optional `bottomContent`.

### [.clearLines](index.js#L145)
### [.clearLines](index.js#L146)

@@ -44,3 +44,3 @@ Remove `n` lines from the bottom of the terminal

Partially based on code in Inquirer.
Inspired by the "screen manager" code in Inquirer.

@@ -51,5 +51,5 @@ ## About

* [enquirer-question](https://www.npmjs.com/package/enquirer-question): Question object, used by Enquirer and prompt plugins. | [homepage](https://github.com/enquirer/enquirer-question "Question object, used by Enquirer and prompt plugins.")
* [enquirer](https://www.npmjs.com/package/enquirer): Intuitive, plugin-based prompt system for node.js. Much faster and lighter alternative to Inquirer, with all… [more](https://github.com/enquirer/enquirer) | [homepage](https://github.com/enquirer/enquirer "Intuitive, plugin-based prompt system for node.js. Much faster and lighter alternative to Inquirer, with all the same prompt types and more, but without the bloat.")
* [prompt-choices](https://www.npmjs.com/package/prompt-choices): Create an array of multiple choice objects for use in prompts. | [homepage](https://github.com/enquirer/prompt-choices "Create an array of multiple choice objects for use in prompts.")
* [prompt-question](https://www.npmjs.com/package/prompt-question): Question object, used by Enquirer and prompt plugins. | [homepage](https://github.com/enquirer/prompt-question "Question object, used by Enquirer and prompt plugins.")
* [readline-utils](https://www.npmjs.com/package/readline-utils): Readline utils, for moving the cursor, clearing lines, creating a readline interface, and more. | [homepage](https://github.com/enquirer/readline-utils "Readline utils, for moving the cursor, clearing lines, creating a readline interface, and more.")

@@ -95,2 +95,2 @@

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 07, 2017._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 09, 2017._
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc