Example #1
0
File: apply.go Project: hdpe/rog-go
func writeData(win *acme.Win, data []byte) error {
	if len(data) == 0 {
		_, err := win.Write("data", nil)
		return err
	}
	for len(data) > 0 {
		d := data
		if len(d) > 8000 {
			d = trimIncompleteRune(d[0:8000])
		}
		n, err := win.Write("data", d)
		if err != nil {
			return err
		}
		data = data[n:]
	}
	return nil
}
Example #2
0
func clear(win *acme.Win) {
	win.Addr("0,$")
	if _, err := win.Write("data", []byte{}); err != nil {
		panic(err)
	}
}