vendor: update github.com/peterh/liner

This commit is contained in:
Felix Lange
2016-11-03 19:51:19 +01:00
parent ed2bc7fbe9
commit ac9013162e
8 changed files with 131 additions and 78 deletions

View File

@ -32,6 +32,7 @@ type commonState struct {
cursorRows int
maxRows int
shouldRestart ShouldRestart
needRefresh bool
}
// TabStyle is used to select how tab completions are displayed.
@ -58,7 +59,12 @@ var ErrPromptAborted = errors.New("prompt aborted")
// platform is normally supported, but stdout has been redirected
var ErrNotTerminalOutput = errors.New("standard output is not a terminal")
// Max elements to save on the killring
// ErrInvalidPrompt is returned from Prompt or PasswordPrompt if the
// prompt contains any unprintable runes (including substrings that could
// be colour codes on some platforms).
var ErrInvalidPrompt = errors.New("invalid prompt")
// KillRingMax is the max number of elements to save on the killring.
const KillRingMax = 60
// HistoryLimit is the maximum number of entries saved in the scrollback history.
@ -133,6 +139,13 @@ func (s *State) AppendHistory(item string) {
}
}
// ClearHistory clears the scroollback history.
func (s *State) ClearHistory() {
s.historyMutex.Lock()
defer s.historyMutex.Unlock()
s.history = nil
}
// Returns the history lines starting with prefix
func (s *State) getHistoryByPrefix(prefix string) (ph []string) {
for _, h := range s.history {