Skip to content

Commit

Permalink
Merge pull request #398 from pterm/387-user-input-reappears-with-inte…
Browse files Browse the repository at this point in the history
…ractivetextinput
  • Loading branch information
MarvinJWendt committed Sep 4, 2022
2 parents 63b9d9e + 317f2bf commit 12bd74e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions interactive_textinput_printer.go
Expand Up @@ -31,25 +31,25 @@ type InteractiveTextInputPrinter struct {
}

// WithDefaultText sets the default text.
func (p *InteractiveTextInputPrinter) WithDefaultText(text string) *InteractiveTextInputPrinter {
func (p InteractiveTextInputPrinter) WithDefaultText(text string) *InteractiveTextInputPrinter {
p.DefaultText = text
return p
return &p
}

// WithTextStyle sets the text style.
func (p *InteractiveTextInputPrinter) WithTextStyle(style *Style) *InteractiveTextInputPrinter {
func (p InteractiveTextInputPrinter) WithTextStyle(style *Style) *InteractiveTextInputPrinter {
p.TextStyle = style
return p
return &p
}

// WithMultiLine sets the multi line flag.
func (p *InteractiveTextInputPrinter) WithMultiLine(multiLine ...bool) *InteractiveTextInputPrinter {
func (p InteractiveTextInputPrinter) WithMultiLine(multiLine ...bool) *InteractiveTextInputPrinter {
p.MultiLine = internal.WithBoolean(multiLine)
return p
return &p
}

// Show shows the interactive select menu and returns the selected entry.
func (p *InteractiveTextInputPrinter) Show(text ...string) (string, error) {
func (p InteractiveTextInputPrinter) Show(text ...string) (string, error) {
// should be the first defer statement to make sure it is executed last
// and all the needed cleanup can be done before
cancel, exit := internal.NewCancelationSignal()
Expand Down Expand Up @@ -195,7 +195,7 @@ func (p *InteractiveTextInputPrinter) Show(text ...string) (string, error) {
return strings.ReplaceAll(areaText, p.text, ""), nil
}

func (p *InteractiveTextInputPrinter) updateArea(area *AreaPrinter) string {
func (p InteractiveTextInputPrinter) updateArea(area *AreaPrinter) string {
if !p.MultiLine {
p.cursorYPos = 0
}
Expand Down

0 comments on commit 12bd74e

Please sign in to comment.