icyflame / cli-cube-timer

Time your solves, without leaving the terminal
https://npmjs.org/package/cli-cube-timer
20 stars 5 forks source link

swap function of 'ctrl + c' & 'e' keypress #42

Closed Jan-Ka closed 7 years ago

Jan-Ka commented 7 years ago

'Ctrl + C' is used to terminate applications in command line environments.

Using it for something different but exiting the current application is strange. My proposal is to swap the functionality of 'Ctrl + C' and the 'E'.

Meaning 'E' should Pause the Application while 'Ctrl + C' will exit. A key better than 'E' would be 'P' for pause in my opinion.

If a single key is desired consider switching to 'Q' for Quit and 'P' for Pause while disabling 'Ctrl + C' altogether.

icyflame commented 7 years ago

Hey @Jan-Ka , what do you mean by "Pause"? Do you mean stopping the session timer? (i.e the time that is shown at the end of the session and in the session statistics)

Jan-Ka commented 7 years ago

Hi @icyflame,

I'm refering to this line in index.js. I would just swap this with pressing the 'e' key and vice versa. Sorry for not making this obvious - just wanted to put this issue in while I was doing something else in the codebase.

icyflame commented 7 years ago

Actually, I am not sure why that line even exists. :thinking:

Funnily, if you press Ctrl + C within solve, then it will pause stdin, effectively isolating the process from everyone else. You can't send it any more keys. So, I think that line shouldn't be there! I will think about this a bit more, if I can't figure it out, that line needs to go. Can you think of any reason why that might be there? It's baffling why I put it in there in the first place.

Jan-Ka commented 7 years ago

No, nothing comes to mind.

The feature it provides should be kept however or at least replaced with something similar. Canceling the current solve maybe? It should just reset everything and write a 'DNF' (or maybe nothing at all) if you get disturbed during the solve.

icyflame commented 7 years ago

Actually, as it stands now, ctrl+c doesn't stop the solve. It doesn't do anything, it simply stops listening to the keyboard and then you can only clean the terminal. I will remove it in the next release that I am preparing now.

Also, that is a GREAT feature. Trashing a solve!

It happens to me all the time, I generally open the file and delete the line.