Merge pull request #175 from kei-s/fix-prompt-option

Fix to show prompt by command line option
This commit is contained in:
lestrrat 2014-08-21 10:09:26 +09:00
commit e11b2b8ab5
2 changed files with 6 additions and 8 deletions

View file

@ -161,6 +161,10 @@ func main() {
}
}
if len(opts.OptPrompt) > 0 {
ctx.SetPrompt(opts.OptPrompt)
}
// Deprecated. --no-ignore-case options will be removed in later.
if opts.OptNoIgnoreCase {
ctx.SetCurrentMatcher(peco.CaseSensitiveMatch)
@ -225,10 +229,6 @@ func main() {
view.Refresh()
}
if len(opts.OptPrompt) > 0 {
ctx.SetPrompt([]rune(opts.OptPrompt))
}
ctx.WaitDone()
st = ctx.ExitStatus

6
ctx.go
View file

@ -43,7 +43,6 @@ type Ctx struct {
result []Match
mutex sync.Mutex
query []rune
prompt []rune
caretPos int
currentLine int
currentPage *PageInfo
@ -69,7 +68,6 @@ func NewCtx(o CtxOptions) *Ctx {
[]Match{},
sync.Mutex{},
[]rune{},
[]rune{},
0,
o.InitialIndex(),
&PageInfo{0, 1, 0},
@ -289,6 +287,6 @@ func (s *signalHandler) Loop() {
}
}
func (c *Ctx) SetPrompt(p []rune) {
c.prompt = p
func (c *Ctx) SetPrompt(p string) {
c.config.Prompt = p
}