[feature request] up/down key stroke to browse history or predefined values #16

Open
sdolard opened this Issue Sep 14, 2011 · 6 comments

Comments

Projects
None yet
6 participants

sdolard commented Sep 14, 2011

Hi,

It should be great to browse prompt history (or a defined list of value) by up/down key stroke.

ps: thanks for this great node tool :)

Contributor

AvianFlu commented Sep 14, 2011

+1, I've thought about this before and it would be very useful.

Contributor

jfhbrook commented Sep 26, 2011

Don't we even store command history already? You'd just have to listen to keypress events I'd imagine.

Edit: +1 btw

luk- commented Nov 10, 2011

Keypress events are only picked up live if the tty has raw mode enabled. Such as in readLineHidden():

try { tty.setRawMode(true) }
  catch (ex) { }

I've been messing a bit with filtering input through a helper function with tty raw mode enabled. It listens for up/down presses and passes through everything else to the prompt, but there's probably a better way of doing this.

Once up/down key presses are handled nicely, working with the history seems like it would be pretty trivial. If no one else finds a better way of doing this I'll upload this on a fork.

Contributor

jfhbrook commented Nov 10, 2011

Buffering the input yourself and listening to the keypresses seems like a reasonable thing to do to me. I think it's also why nobody's tried doing this yet.

If you can make it work, definitely +1. That would be rad.

ecokeley commented May 9, 2013

This would be awesome. If it's not being worked on I'm writing it for a project at work. I'll share if I get it done.

CoderK commented May 1, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment