peterh / liner

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

Ability to override some key behaviours #54

Closed mhagander closed 8 years ago

mhagander commented 8 years ago

It would be very useful to have a callback (or similar) to make it possible to override some key behaviours as well as trap other keys.

For example, I would like to disable Ctrl-L from rewriting the screen empty.

It would also be very useful to be able to trap a key combinations and do other things - for example trap a Ctrl- to make the application do something completely different, and just cancel the prompt at that point.

Probably the same feature could be used for both those, as long as there can be a return value that specifies "do what you would normally do", "ignore this key" or "abort the prompt at this stage".

peterh commented 8 years ago

Thanks for the feature request, but liner is supposed to be simple.

In combination with your previous feature request, it sounds like you probably want something based on curses/ncurses instead of liner.