1
0
mirror of https://github.com/mum4k/termdash.git synced 2025-04-28 13:48:51 +08:00

Merge branch 'devel' into donut

This commit is contained in:
Jakub Sobon 2019-01-19 20:52:27 -05:00
commit ebc275c4b3
3 changed files with 8 additions and 16 deletions

View File

@ -50,11 +50,11 @@ const (
// ColorMode216 supports only the third range of the ColorMode256, i.e the // ColorMode216 supports only the third range of the ColorMode256, i.e the
// 216 different terminal colors. However in this mode the colors are zero // 216 different terminal colors. However in this mode the colors are zero
// based, so the called doesn't need to provide an offset. // based, so the caller doesn't need to provide an offset.
ColorMode216 ColorMode216
// ColorModeGrayscale supports only the fourth range of the ColorMode256, // ColorModeGrayscale supports only the fourth range of the ColorMode256,
// i.e the 24 different shades of grey. However in this mode the colors are // i.e the 24 different shades of grey. However in this mode the colors are
// zero based, so the called doesn't need to provide an offset. // zero based, so the caller doesn't need to provide an offset.
ColorModeGrayscale ColorModeGrayscale
) )

View File

@ -240,7 +240,7 @@ func (t *Text) Draw(cvs *canvas.Canvas) error {
return nil return nil
} }
// Implements widgetapi.Widget.Keyboard. // Keyboard implements widgetapi.Widget.Keyboard.
func (t *Text) Keyboard(k *terminalapi.Keyboard) error { func (t *Text) Keyboard(k *terminalapi.Keyboard) error {
t.mu.Lock() t.mu.Lock()
defer t.mu.Unlock() defer t.mu.Unlock()
@ -258,7 +258,7 @@ func (t *Text) Keyboard(k *terminalapi.Keyboard) error {
return nil return nil
} }
// Implements widgetapi.Widget.Mouse. // Mouse implements widgetapi.Widget.Mouse.
func (t *Text) Mouse(m *terminalapi.Mouse) error { func (t *Text) Mouse(m *terminalapi.Mouse) error {
t.mu.Lock() t.mu.Lock()
defer t.mu.Unlock() defer t.mu.Unlock()
@ -272,6 +272,7 @@ func (t *Text) Mouse(m *terminalapi.Mouse) error {
return nil return nil
} }
// Options of the widget
func (t *Text) Options() widgetapi.Options { func (t *Text) Options() widgetapi.Options {
return widgetapi.Options{ return widgetapi.Options{
// At least one line with at least one full-width rune. // At least one line with at least one full-width rune.

View File

@ -99,10 +99,7 @@ func TestTextDraws(t *testing.T) {
if err := widget.Write(" "); err != nil { if err := widget.Write(" "); err != nil {
return err return err
} }
if err := widget.Write("world"); err != nil { return widget.Write("world")
return err
}
return nil
}, },
want: func(size image.Point) *faketerm.Terminal { want: func(size image.Point) *faketerm.Terminal {
ft := faketerm.MustNew(size) ft := faketerm.MustNew(size)
@ -124,10 +121,7 @@ func TestTextDraws(t *testing.T) {
return err return err
} }
widget.Reset() widget.Reset()
if err := widget.Write("world"); err != nil { return widget.Write("world")
return err
}
return nil
}, },
want: func(size image.Point) *faketerm.Terminal { want: func(size image.Point) *faketerm.Terminal {
ft := faketerm.MustNew(size) ft := faketerm.MustNew(size)
@ -164,10 +158,7 @@ func TestTextDraws(t *testing.T) {
if err := widget.Write("red\n", WriteCellOpts(cell.FgColor(cell.ColorRed))); err != nil { if err := widget.Write("red\n", WriteCellOpts(cell.FgColor(cell.ColorRed))); err != nil {
return err return err
} }
if err := widget.Write("blue\n", WriteCellOpts(cell.FgColor(cell.ColorBlue))); err != nil { return widget.Write("blue\n", WriteCellOpts(cell.FgColor(cell.ColorBlue)))
return err
}
return nil
}, },
want: func(size image.Point) *faketerm.Terminal { want: func(size image.Point) *faketerm.Terminal {
ft := faketerm.MustNew(size) ft := faketerm.MustNew(size)