okami.mom/ultraviolet

git clone https://git.nkp.pet/okami.mom/ultraviolet

Ayman Bagabaschore: add cursor shape tests25e48a6

upstream
481 B22 linesraw
1package uv
2
3// CursorShape represents a terminal cursor shape.
4type CursorShape int
5
6// Cursor shapes.
7const (
8	CursorBlock CursorShape = iota
9	CursorUnderline
10	CursorBar
11)
12
13// Encode returns the encoded value for the cursor shape.
14func (s CursorShape) Encode(blink bool) int {
15	// We're using the ANSI escape sequence values for cursor styles.
16	// We need to map both [style] and [steady] to the correct value.
17	s = (s * 2) + 1 //nolint:mnd
18	if !blink {
19		s++
20	}
21	return int(s)
22}