Skip to content

Commit

Permalink
cops: specialize render cursor handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jcorbin committed Dec 10, 2017
1 parent 918949f commit 6defcff
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/cops/display/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ func RenderOver(buf []byte, cur Cursor, over, under *Display, renderColor ColorM
if under != nil {
j = under.Text.StringsOffset(pt.X, pt.Y)
}
buf, cur = cur.Go(buf, pt)
for i < len(over.Text.Strings) {
var ut string
var uf, ub color.RGBA
Expand All @@ -208,7 +209,12 @@ func RenderOver(buf []byte, cur Cursor, over, under *Display, renderColor ColorM
ut = " "
}
if ot != ut || of != uf || ob != ub {
buf, cur = cur.Go(buf, pt)
if dy := pt.Y - cur.Position.Y; dy > 0 {
buf, cur = cur.linedown(buf, dy)
}
if dx := pt.X - cur.Position.X; dx > 0 {
buf, cur = cur.right(buf, dx)
}
buf, cur = renderColor(buf, cur, of, ob)
buf, cur = cur.WriteGlyph(buf, ot)
if under != nil {
Expand Down

0 comments on commit 6defcff

Please sign in to comment.