func (t *tbfe) clip(v *backend.View, s, e int) Region { p := util.Prof.Enter("clip") defer p.Exit() t.lock.Lock() h := t.layout[v].height t.lock.Unlock() if e-s > h { e = s + h } else if e-s < h { s = e - h } if e2, _ := v.RowCol(v.TextPoint(e, 0)); e2 < e { e = e2 } if s < 0 { s = 0 } e = s + h r := Region{v.TextPoint(s, 0), v.TextPoint(e, 0)} return v.LineR(r) }