Update CHANGELOG for v0.2.2 release.

This commit is contained in:
c-bata 2018-06-28 15:11:04 +09:00
parent 536e34532a
commit 13b6d0938a
6 changed files with 13 additions and 22 deletions

@ -1,6 +1,10 @@
# Change Log # Change Log
## v0.2.2 (2018/??/??) ## v0.3.0 (2018/??/??)
next release.
## v0.2.2 (2018/06/28)
### What's new? ### What's new?
@ -10,11 +14,6 @@
* Add FilePathCompleter to complete file path on your system. * Add FilePathCompleter to complete file path on your system.
* Add option to customize ascii code key bindings. * Add option to customize ascii code key bindings.
* Add GetWordAfterCursor method in Document. * Add GetWordAfterCursor method in Document.
* Add SetDisplayAttributes in ConsoleWriter for flexible customizing display attributes.
### Fixed
* Fix a bug in docker container [issue #39](https://github.com/c-bata/go-prompt/issues/39)
### Removed or Deprecated ### Removed or Deprecated

@ -125,9 +125,8 @@ func (d *Document) FindStartOfPreviousWord() int {
i := strings.LastIndexByte(x, ' ') i := strings.LastIndexByte(x, ' ')
if i != -1 { if i != -1 {
return i + 1 return i + 1
} else {
return 0
} }
return 0
} }
// FindStartOfPreviousWordWithSpace is almost the same as FindStartOfPreviousWord. // FindStartOfPreviousWordWithSpace is almost the same as FindStartOfPreviousWord.
@ -157,9 +156,8 @@ func (d *Document) FindStartOfPreviousWordUntilSeparator(sep string) int {
i := strings.LastIndexAny(x, sep) i := strings.LastIndexAny(x, sep)
if i != -1 { if i != -1 {
return i + 1 return i + 1
} else {
return 0
} }
return 0
} }
// FindStartOfPreviousWordUntilSeparatorIgnoreNextToCursor is almost the same as FindStartOfPreviousWordWithSpace. // FindStartOfPreviousWordUntilSeparatorIgnoreNextToCursor is almost the same as FindStartOfPreviousWordWithSpace.
@ -188,9 +186,8 @@ func (d *Document) FindEndOfCurrentWord() int {
i := strings.IndexByte(x, ' ') i := strings.IndexByte(x, ' ')
if i != -1 { if i != -1 {
return i return i
} else {
return len(x)
} }
return len(x)
} }
// FindEndOfCurrentWordWithSpace is almost the same as FindEndOfCurrentWord. // FindEndOfCurrentWordWithSpace is almost the same as FindEndOfCurrentWord.
@ -222,9 +219,8 @@ func (d *Document) FindEndOfCurrentWordUntilSeparator(sep string) int {
i := strings.IndexAny(x, sep) i := strings.IndexAny(x, sep)
if i != -1 { if i != -1 {
return i return i
} else {
return len(x)
} }
return len(x)
} }
// FindEndOfCurrentWordUntilSeparatorIgnoreNextToCursor is almost the same as FindEndOfCurrentWordWithSpace. // FindEndOfCurrentWordUntilSeparatorIgnoreNextToCursor is almost the same as FindEndOfCurrentWordWithSpace.

@ -1,6 +1,6 @@
package prompt package prompt
// CursorLineEnd Go to the End of the line // GoLineEnd Go to the End of the line
func GoLineEnd(buf *Buffer) { func GoLineEnd(buf *Buffer) {
x := []rune(buf.Document().TextAfterCursor()) x := []rune(buf.Document().TextAfterCursor())
buf.CursorRight(len(x)) buf.CursorRight(len(x))

@ -217,7 +217,7 @@ func OptionAddKeyBind(b ...KeyBind) Option {
} }
} }
// OptionAddKeyBind to set a custom key bind. // OptionAddASCIICodeBind to set a custom key bind.
func OptionAddASCIICodeBind(b ...ASCIICodeBind) Option { func OptionAddASCIICodeBind(b ...ASCIICodeBind) Option {
return func(p *Prompt) error { return func(p *Prompt) error {
p.ASCIICodeBindings = append(p.ASCIICodeBindings, b...) p.ASCIICodeBindings = append(p.ASCIICodeBindings, b...)

@ -16,7 +16,7 @@ const (
DisplayUnderline DisplayUnderline
// DisplayBlink set blink (less than 150 per minute). // DisplayBlink set blink (less than 150 per minute).
DisplayBlink DisplayBlink
// DisplayBlink set blink (more than 150 per minute). Not widely supported. // DisplayRapidBlink set blink (more than 150 per minute). Not widely supported.
DisplayRapidBlink DisplayRapidBlink
// DisplayReverse swap foreground and background colors. // DisplayReverse swap foreground and background colors.
DisplayReverse DisplayReverse
@ -144,8 +144,5 @@ type ConsoleWriter interface {
/* Font */ /* Font */
// SetColor sets text and background colors. and specify whether text is bold. // SetColor sets text and background colors. and specify whether text is bold.
// Deprecated. This interface is not cool, please use SetDisplayAttributes.
SetColor(fg, bg Color, bold bool) SetColor(fg, bg Color, bold bool)
// SetDisplayAttributes set display attributes (Set colors, blink, bold, italic and so on).
SetDisplayAttributes(fg, bg Color, attrs ...DisplayAttribute)
} }

@ -232,7 +232,6 @@ func (w *VT100Writer) ClearTitle() {
/* Font */ /* Font */
// SetColor sets text and background colors. and specify whether text is bold. // SetColor sets text and background colors. and specify whether text is bold.
// Deprecated. This interface is not cool, please use SetDisplayAttributes.
func (w *VT100Writer) SetColor(fg, bg Color, bold bool) { func (w *VT100Writer) SetColor(fg, bg Color, bold bool) {
if bold { if bold {
w.SetDisplayAttributes(fg, bg, DisplayBold) w.SetDisplayAttributes(fg, bg, DisplayBold)
@ -242,7 +241,7 @@ func (w *VT100Writer) SetColor(fg, bg Color, bold bool) {
return return
} }
// SetDisplayAttributes set display attributes (Set colors, blink, bold, italic and so on). // SetDisplayAttributes to set VT100 display attributes.
func (w *VT100Writer) SetDisplayAttributes(fg, bg Color, attrs ...DisplayAttribute) { func (w *VT100Writer) SetDisplayAttributes(fg, bg Color, attrs ...DisplayAttribute) {
w.WriteRaw([]byte{0x1b, '['}) // control sequence introducer w.WriteRaw([]byte{0x1b, '['}) // control sequence introducer
defer w.WriteRaw([]byte{'m'}) // final character defer w.WriteRaw([]byte{'m'}) // final character