peterh / liner

Pure Go line editor with history, inspired by linenoise
MIT License
1.05k stars 132 forks source link

Add SetShouldRestart. #67

Closed michaelmacinnis closed 8 years ago

michaelmacinnis commented 8 years ago

I use liner in a program that shares the terminal with other applications. Under certain circumstances my application regains control of the terminal unexpectedly which causes readNext to return an error. In these cases the call to readNext can be restarted after performing some housekeeping.

I have added the callback shouldRestart and SetShouldRestart to accomplish this. Please consider these names placeholders. I have tried to keep the changes to liner to a minimum.

peterh commented 8 years ago

Thanks for the patch.

I'm having trouble imagining the circumstances where this matters, but the patch is clean and well commented. Pulled.