about summary refs log tree commit diff stats
path: root/120allocate.subx
Commit message (Expand)AuthorAgeFilesLines
* debugging helper: heap remainingKartik K. Agaram2021-08-101-0/+12
* print call stack on all low-level errorsKartik K. Agaram2021-05-151-12/+3
* a little bit more information when lookup failsKartik K. Agaram2021-05-071-1/+31
* expand stack to 16MBKartik K. Agaram2021-04-251-1/+1
* expand memory to 2GBKartik K. Agaram2021-04-251-1/+1
* expand heap to Qemu defaultKartik Agaram2021-04-251-1/+1
* revert experiment: expand heapKartik K. Agaram2021-04-181-1/+1
* experiment: expand heapKartik K. Agaram2021-04-181-1/+1
* 7842 - new directory organizationKartik K. Agaram2021-03-031-123/+70
* 7526Kartik Agaram2021-01-161-0/+14
* 7483Kartik Agaram2021-01-091-1/+1
* 7138 - type-check array 'length' instructionKartik Agaram2020-10-291-1/+1
* 6742 - support for formatting in fake screensKartik Agaram2020-09-071-4/+4
* 6659Kartik Agaram2020-07-181-7/+7
* 6658Kartik Agaram2020-07-181-1/+1
* 6643Kartik Agaram2020-07-131-1/+1
* 6627Kartik Agaram2020-07-101-2/+2
* 6612 - reorganize layersKartik Agaram2020-07-051-0/+953
light .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
package widgets

import (
	"github.com/gdamore/tcell"

	"git.sr.ht/~sircmpwn/aerc2/config"
	"git.sr.ht/~sircmpwn/aerc2/lib/ui"
)

type TermHost struct {
	grid *ui.Grid
	term *Terminal
}

// Thin wrapper around terminal which puts it in a grid and passes through
// input events. A bit of a hack tbh
func NewTermHost(term *Terminal, conf *config.AercConfig) *TermHost {
	grid := ui.NewGrid().Rows([]ui.GridSpec{
		{ui.SIZE_WEIGHT, 1},
	}).Columns([]ui.GridSpec{
		{ui.SIZE_EXACT, conf.Ui.SidebarWidth},
		{ui.SIZE_WEIGHT, 1},
	})
	grid.AddChild(term).At(0, 1)
	return &TermHost{grid, term}
}

func (th *TermHost) Draw(ctx *ui.Context) {
	th.grid.Draw(ctx)
}

func (th TermHost) Invalidate() {
	th.grid.Invalidate()
}

func (th *TermHost) OnInvalidate(fn func(d ui.Drawable)) {
	th.grid.OnInvalidate(func(_ ui.Drawable) {
		fn(th)
	})
}

func (th *TermHost) Event(event tcell.Event) bool {
	return th.term.Event(event)
}

func (th *TermHost) Focus(focus bool) {
	th.term.Focus(focus)
}

func (th *TermHost) Terminal() *Terminal {
	return th.term
}