peterh/liner

How to show the history lines when using TAB

Closed this issue · 2 comments

Hello, I'm wondering why not expose the history data to the caller?
The case is when I'm using the tab key, I need to find item from all I have input.
Howerver, the functions which are used to get the history data from the State are all invisible to us. Why not write a function like GetHistoryByPrefix rather than getHistroyByPrefix for the caller to use?

If you want "search history starting with the prompt so far", the hotkey to use is Up instead of Tab.

If you want to keep history to inform your tab completion function, you can keep track of it yourself. (ie. call your own internal AppendHistory function in addition to liner's).

getHistoryByPrefix is not exported because liner already exports way too much API that has to remain compatible across revisions. I wish liner exported fewer functions, not more.

ok, thanks.