From 9dfe97008a4e08591e8a0ed4103860a5bd0cd0be Mon Sep 17 00:00:00 2001 From: kei-s Date: Wed, 20 Aug 2014 20:05:05 +0900 Subject: [PATCH 1/2] Fix to show prompt by command line option --- cmd/peco/peco.go | 8 ++++---- ctx.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/peco/peco.go b/cmd/peco/peco.go index 5c18b98..c527c97 100644 --- a/cmd/peco/peco.go +++ b/cmd/peco/peco.go @@ -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 diff --git a/ctx.go b/ctx.go index 6db75cf..c6dbad5 100644 --- a/ctx.go +++ b/ctx.go @@ -289,6 +289,6 @@ func (s *signalHandler) Loop() { } } -func (c *Ctx) SetPrompt(p []rune) { - c.prompt = p +func (c *Ctx) SetPrompt(p string) { + c.config.Prompt = p } From c7c95f8cbd8e48732abdab20e0b5cc5ef8d89895 Mon Sep 17 00:00:00 2001 From: kei-s Date: Wed, 20 Aug 2014 20:08:51 +0900 Subject: [PATCH 2/2] Remove unused field --- ctx.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/ctx.go b/ctx.go index c6dbad5..2748e10 100644 --- a/ctx.go +++ b/ctx.go @@ -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},