From 715666277d37055a5dce087977c1b2634ef43a55 Mon Sep 17 00:00:00 2001 From: Gordon Bleux Date: Thu, 27 Feb 2020 19:01:43 +0100 Subject: [PATCH] add support for managing the initial buffer content. the option will modify the buffer content upon startup and works in combination with `OptionShowCompletionAtStart()`. --- option.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/option.go b/option.go index abce19a..bfd09f1 100644 --- a/option.go +++ b/option.go @@ -37,6 +37,14 @@ func OptionPrefix(x string) Option { } } +// OptionInitialBufferText to set the initial buffer text +func OptionInitialBufferText(x string) Option { + return func(p *Prompt) error { + p.buf.InsertText(x, false, true) + return nil + } +} + // OptionCompletionWordSeparator to set word separators. Enable only ' ' if empty. func OptionCompletionWordSeparator(x string) Option { return func(p *Prompt) error {