Fix title option

This commit is contained in:
c-bata 2017-07-17 02:18:11 +09:00
parent afa85b3f5c
commit d94b119cd7
3 changed files with 4 additions and 6 deletions

View File

@ -20,7 +20,7 @@ func WriterOption(x ConsoleWriter) option {
func TitleOption(x string) option {
return func(p *Prompt) error {
p.title = x
p.renderer.title = x
return nil
}
}
@ -54,7 +54,6 @@ func NewPrompt(executor Executor, completer Completer, opts ...option) *Prompt {
prefixColor: "green",
out: &VT100Writer{fd: syscall.Stdout},
},
title: "",
buf: NewBuffer(),
executor: executor,
completer: completer,

View File

@ -14,7 +14,6 @@ type Prompt struct {
in ConsoleParser
buf *Buffer
renderer *Render
title string
executor Executor
completer Completer
chosen int // -1 means nothing one is chosen.

View File

@ -3,7 +3,7 @@ package prompt
type Render struct {
prefix string
prefixColor string
Title string
title string
out ConsoleWriter
row uint16
col uint16
@ -11,8 +11,8 @@ type Render struct {
}
func (r *Render) Setup() {
if r.Title != "" {
r.out.SetTitle(r.Title)
if r.title != "" {
r.out.SetTitle(r.title)
}
r.renderPrefix()
r.out.Flush()