-
Notifications
You must be signed in to change notification settings - Fork 0
/
cell.go
33 lines (28 loc) · 795 Bytes
/
cell.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package tcellterm
import "github.com/gdamore/tcell/v2"
type cell struct {
content rune
combining []rune
width int
attrs tcell.Style
wrapped bool
}
func (c *cell) rune() rune {
if c.content == rune(0) {
return ' '
}
return c.content
}
// Erasing removes characters from the screen without affecting other characters
// on the screen. Erased characters are lost. The cursor position does not
// change when erasing characters or lines. Erasing resets the attributes, but
// applies the background color of the passed style
func (c *cell) erase(s tcell.Style) {
_, bg, _ := s.Decompose()
c.content = 0
c.attrs = tcell.StyleDefault.Background(bg)
}
// selectiveErase removes the cell content, but keeps the attributes
func (c *cell) selectiveErase() {
c.content = 0
}