mirror of https://github.com/mum4k/termdash.git
added the ability to swap the scrolling runes
This commit is contained in:
parent
2a7dafa3a8
commit
8a316e6c1b
|
@ -32,6 +32,8 @@ type Option interface {
|
||||||
|
|
||||||
// options stores the provided options.
|
// options stores the provided options.
|
||||||
type options struct {
|
type options struct {
|
||||||
|
scrollUp rune
|
||||||
|
scrollDown rune
|
||||||
wrapMode wrap.Mode
|
wrapMode wrap.Mode
|
||||||
rollContent bool
|
rollContent bool
|
||||||
disableScrolling bool
|
disableScrolling bool
|
||||||
|
@ -46,6 +48,8 @@ type options struct {
|
||||||
// newOptions returns a new options instance.
|
// newOptions returns a new options instance.
|
||||||
func newOptions(opts ...Option) *options {
|
func newOptions(opts ...Option) *options {
|
||||||
opt := &options{
|
opt := &options{
|
||||||
|
scrollUp: DefaultScrollUpRune,
|
||||||
|
scrollDown: DefaultScrollDownRune,
|
||||||
mouseUpButton: DefaultScrollMouseButtonUp,
|
mouseUpButton: DefaultScrollMouseButtonUp,
|
||||||
mouseDownButton: DefaultScrollMouseButtonDown,
|
mouseDownButton: DefaultScrollMouseButtonDown,
|
||||||
keyUp: DefaultScrollKeyUp,
|
keyUp: DefaultScrollKeyUp,
|
||||||
|
@ -84,6 +88,22 @@ func (o option) set(opts *options) {
|
||||||
o(opts)
|
o(opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ScrollRunes configures the text widgets scroll runes, shown at the top and
|
||||||
|
// bottom of a scrollable text widget. If not provided, the default scroll
|
||||||
|
// runes will be used.
|
||||||
|
func ScrollRunes(up, down rune) Option {
|
||||||
|
return option(func(opts *options) {
|
||||||
|
opts.scrollUp = up
|
||||||
|
opts.scrollDown = down
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// The default scroll runes for content scrolling
|
||||||
|
const (
|
||||||
|
DefaultScrollUpRune = '⇧'
|
||||||
|
DefaultScrollDownRune = '⇩'
|
||||||
|
)
|
||||||
|
|
||||||
// WrapAtWords configures the text widget so that it automatically wraps lines
|
// WrapAtWords configures the text widget so that it automatically wraps lines
|
||||||
// that are longer than the width of the widget at word boundaries. If not
|
// that are longer than the width of the widget at word boundaries. If not
|
||||||
// provided, long lines are trimmed instead.
|
// provided, long lines are trimmed instead.
|
||||||
|
|
Loading…
Reference in New Issue