add damage tracking to vt#792
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #792 +/- ##
===========================================
- Coverage 45.17% 34.28% -10.90%
===========================================
Files 193 20 -173
Lines 13807 1709 -12098
===========================================
- Hits 6238 586 -5652
+ Misses 7189 1044 -6145
+ Partials 380 79 -301 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| // ClearTouched clears the touched state. | ||
| func (s *Screen) ClearTouched() { | ||
| s.buf.Touched = make([]*uv.LineData, s.buf.Height()) |
There was a problem hiding this comment.
Note that uv allocates this slices on calls to buf.Touch and buf.TouchLine etc. So I think this is enough
| s.buf.Touched = make([]*uv.LineData, s.buf.Height()) | |
| s.buf.Touched = nil |
| s.buf = uv.NewRenderBuffer(width, height) | ||
| } else { | ||
| s.buf.Resize(width, height) | ||
| s.buf.Touched = make([]*uv.LineData, height) |
There was a problem hiding this comment.
Same. Setting it to nil should be enough
| s.buf.Touched = make([]*uv.LineData, height) | |
| s.buf.Touched = nil |
| // touchAll marks all lines as touched. | ||
| func (s *Screen) touchAll() { | ||
| s.touchArea(s.buf.Bounds()) | ||
| } |
There was a problem hiding this comment.
This is equivalent to setting the Touched slice to nil. The terminal renderer treat a nil Touched as all lines where "touched"
CONTRIBUTING.md.I reviewed #652 before submitting this, but that PR relies on ultraviolet functionality that's since been removed.
This implementation is (probably?) better now with the new ultraviolet:
• Pre-allocated slice, no per-event allocations
• Simple min/max tracking per line
• No callback overhead
Missing a few things, like scroll direction, though.