File: cell.go

package info (click to toggle)
golang-sourcehut-rockorager-tcell-term 0.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 1,216 kB
  • sloc: makefile: 2
file content (33 lines) | stat: -rw-r--r-- 795 bytes parent folder | download
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
}