mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-14 19:27:58 +08:00
d2936c06a1
This is needed since there can now be an arbitrary number of widgets competing for vertical space. - Add a new MaxHeight method to the tk.Widget interface to provide hint on how to distribute the height. - Implement the algorithm in distributeHeight in cli/app.go.
24 lines
506 B
Go
24 lines
506 B
Go
package tk
|
|
|
|
import (
|
|
"src.elv.sh/pkg/cli/term"
|
|
)
|
|
|
|
// Empty is an empty widget.
|
|
type Empty struct{}
|
|
|
|
// Render shows nothing, although the resulting Buffer still occupies one line.
|
|
func (Empty) Render(width, height int) *term.Buffer {
|
|
return term.NewBufferBuilder(width).Buffer()
|
|
}
|
|
|
|
// MaxHeight returns 1, since this widget always occupies one line.
|
|
func (Empty) MaxHeight(width, height int) int {
|
|
return 1
|
|
}
|
|
|
|
// Handle always returns false.
|
|
func (Empty) Handle(event term.Event) bool {
|
|
return false
|
|
}
|