aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/peterh/liner/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/peterh/liner/common.go')
-rw-r--r--vendor/github.com/peterh/liner/common.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/vendor/github.com/peterh/liner/common.go b/vendor/github.com/peterh/liner/common.go
index b6162b624..e5b8fc280 100644
--- a/vendor/github.com/peterh/liner/common.go
+++ b/vendor/github.com/peterh/liner/common.go
@@ -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 {