summaryrefslogtreecommitdiff
path: root/internal/render/instructions.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/render/instructions.go')
-rw-r--r--internal/render/instructions.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/render/instructions.go b/internal/render/instructions.go
index b4823f2..27db5bd 100644
--- a/internal/render/instructions.go
+++ b/internal/render/instructions.go
@@ -35,6 +35,9 @@ type Instruction interface {
}
func overlap(over, under Instruction) overlapType {
+ if over == nil || under == nil {
+ return CoverNone
+ }
ox, oy := over.Pos()
ux, uy := under.Pos()
os, us := over.Len(), under.Len()
@@ -78,6 +81,9 @@ func overlap(over, under Instruction) overlapType {
// No matter what, the over instruction never changes so only variations of
// under needs to be returned.
func squash(over Instruction, under Instruction, ot overlapType) []Instruction {
+ if over == nil || under == nil {
+ return nil
+ }
ox, _ := over.Pos()
ux, _ := under.Pos()
os, us := over.Len(), under.Len()
@@ -174,7 +180,7 @@ type ClearInstruction struct {
func (c ClearInstruction) Write(w io.Writer) {
// Erase as many characters as the size of the instruction.
- msg := reach(c) + "\033[K" + strings.Repeat(" ", c.Size)
+ msg := reach(c) + "\033[0m" + strings.Repeat(" ", c.Size)
// TODO: maybe implement a way to log stuff like writestring errors
io.WriteString(w, msg)
}