peterh / liner

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

How to show the history lines when using TAB #90

Closed zuiaiqun closed 7 years ago

zuiaiqun commented 7 years ago

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?

peterh commented 7 years ago

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.

zuiaiqun commented 7 years ago

ok, thanks.