mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-15 11:57:55 +08:00
24 lines
620 B
Go
24 lines
620 B
Go
package cli
|
|
|
|
// GetCodeBuffer returns the code buffer of the main code area widget of the app.
|
|
func GetCodeBuffer(a App) CodeBuffer {
|
|
return a.CodeArea().CopyState().Buffer
|
|
}
|
|
|
|
// SetCodeBuffer sets the code buffer of the main code area widget of the app.
|
|
func SetCodeBuffer(a App, buf CodeBuffer) {
|
|
a.CodeArea().MutateState(func(s *CodeAreaState) {
|
|
s.Buffer = buf
|
|
})
|
|
}
|
|
|
|
// Addon gets the current addon widget of the app.
|
|
func Addon(a App) Widget {
|
|
return a.CopyState().Addon
|
|
}
|
|
|
|
// SetAddon sets the addon widget of the app.
|
|
func SetAddon(a App, addon Widget) {
|
|
a.MutateState(func(s *State) { s.Addon = addon })
|
|
}
|