From 58b39dbb6cad157bb211d08eb4a84776bbd7c4c5 Mon Sep 17 00:00:00 2001 From: c-bata Date: Thu, 28 Jun 2018 15:44:23 +0900 Subject: [PATCH] Update CHANGELOG --- CHANGELOG.md | 20 +++++++++++++++++++- option.go | 4 ---- shortcut.go | 20 -------------------- 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9372c1d..209df2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,25 @@ ## v0.3.0 (2018/??/??) -next release. +The architecture of go-prompt are refactored in this release. See [here](https://github.com/c-bata/go-prompt/pull/83) for more details. +Much better in many regards. Please don't hesitate to test this release and file any bug reports. + +### Breaking changes. + +Please caution this release includes breaking changes for who customize ConsoleParser or ConsoleWriter. + +* Remove `GetWinSize` method from `ConsoleParser`. Please use `ConsoleWriter.GetWinSize` instead. +* Remove `GetKey` method from `ConsoleParser`. Please use `GetKey` function instead. +* Add `GetWinSize` and `SIGWINCH` on `ConsoleWriter`. + +### What's new? + +* Correspond window size change events on Windows. + +### Removed or Deprecated + +* Removed Choose shortcut function. +* Removed SwitchKeyBindMode option. please use OptionSwitchKeyBindMode instead. ## v0.2.2 (2018/06/28) diff --git a/option.go b/option.go index 7b818c3..5034711 100644 --- a/option.go +++ b/option.go @@ -248,10 +248,6 @@ func OptionSwitchKeyBindMode(m KeyBindMode) Option { } } -// SwitchKeyBindMode to set a key bind mode. -// Deprecated: Please use OptionSwitchKeyBindMode. -var SwitchKeyBindMode = OptionSwitchKeyBindMode - // OptionAddKeyBind to set a custom key bind. func OptionAddKeyBind(b ...KeyBind) Option { return func(p *Prompt) error { diff --git a/shortcut.go b/shortcut.go index 5153e72..6ac2806 100644 --- a/shortcut.go +++ b/shortcut.go @@ -9,23 +9,3 @@ func Input(prefix string, completer Completer, opts ...Option) string { return pt.Input() } -// Choose to the shortcut of input function to select from string array. -// Deprecated: Maybe anyone want to use this. -func Choose(prefix string, choices []string, opts ...Option) string { - completer := newChoiceCompleter(choices, FilterHasPrefix) - pt := New(nil, completer, opts...) - pt.rendererOptions = append(pt.rendererOptions, func(r *Renderer) { - r.prefix = prefix - }) - return pt.Input() -} - -func newChoiceCompleter(choices []string, filter Filter) Completer { - s := make([]Suggest, len(choices)) - for i := range choices { - s[i] = Suggest{Text: choices[i]} - } - return func(x Document) []Suggest { - return filter(s, x.GetWordBeforeCursor(), true) - } -}