arvindr21/cli-adventure-games

Repeating lines when typing

Closed this issue · 7 comments

after install on windows I tried running the game but every keystroke repeated the previous line

node version v0.12.4
windows 8.1

(I am a brand new user, my friend will help as well @therebelrobot)

Hey @arvindr21 :) @TheGoldenFire is a super beginner at command line, I'm helping him through using command prompt (as best I can being a Mac user), and your module seemed like a good fit (He wanted to play Zork, so this is a good alternative to get him involved with Node).

I'll test this on my system (Mac OS X Yosemite, NVM 0.24.0, io.js 1.8.1) and see if I can duplicate the issue. Will update thread once I have more info.

I was able to duplicate it on my system as listed above. Also tested it using node 0.10.38 with the same result. Here is sample output of what we're seeing:

? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and
? You are on the other side of a burnt broken bridge, you look back to see the debris and a steady stream of water. You turn around and 
see a fountain. (hint : navigate around to explore [ex: `go north`]) go north

With every keystroke, the previous prompt line is repeated, though we can still enter commands properly (enter key submits properly, etc)

I will take a look at the dependencies today, I seem to remember a similar issue on another prompt-based module, though I forget which one right now.

Possibly related to SBoudrias/Inquirer.js#249 ?

Thanks for the interest guys. Yup that is an issue with the inquirer. Not sure if I need to change the CLI input module.

Or probably replace it with custom implementation of process.stdin/process.stdout.

What do you think?

I would suggest avoiding custom implementation. No need to reinvent the wheel if there are ones that already work, right? Lemme take a look around tonight at alternative modules and see if one can't be substituted well. I'm using flatiron/prompt in therebelrobot/gpgez and that seems to be working more or less appropriately, though not sure if it's what you want for this one.

prompt sounds good too. Do let me know what you come up with as well.

Optimizer could work too