Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-cursor-position

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-cursor-position - npm Package Compare versions

Comparing version 0.0.2 to 0.0.4

bin/pos.node

43

index.js

@@ -1,39 +0,9 @@

var deasync = require('deasync');
var tty = require('tty');
var code = '\x1b[6n';
var tty = require('tty');
var pos = require('./bin/pos');
var code = '\x1b[6n';
module.exports = {
sync : function () {
var sync = true;
var position = null;
// start listening
process.stdin.resume();
raw(true);
sync: pos.sync,
process.stdin.once('data', function (b) {
var match = /\[(\d+)\;(\d+)R$/.exec(b.toString());
if (match) {
sync = false;
position = match.slice(1, 3).reverse().map(Number);
}
// cleanup and close stdin
raw(false);
process.stdin.pause();
});
process.stdout.write(code);
process.stdout.emit('data', code);
while (sync) {
deasync.sleep(1);
}
return {
row: position[1],
col: position[0]
};
},
async: function (callback, context) {

@@ -50,3 +20,6 @@

callback && callback.call(context, position[1], position[0]);
callback && callback.call(context, {
row: position[1],
col: position[0]
});
}

@@ -53,0 +26,0 @@

{
"name": "get-cursor-position",
"version": "0.0.2",
"version": "0.0.4",
"description": "Get the cursor's current position in your terminal.",

@@ -27,5 +27,3 @@ "main": "index.js",

"homepage": "https://github.com/bubkoo/get-cursor-position",
"dependencies": {
"deasync": "^0.1.4"
}
"dependencies": {}
}

@@ -24,5 +24,5 @@ # get-cursor-position

getCursorPosition.async(function(row, col) {
console.log('row: ' + row);
console.log('col: ' + col);
getCursorPosition.async(function(pos) {
console.log('row: ' + pos.row);
console.log('col: ' + pos.col);
});

@@ -29,0 +29,0 @@

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