Example #1
0
func drawSelect(s tcell.Screen, x1, y1, x2, y2 int, sel bool) {

	if y2 < y1 {
		y1, y2 = y2, y1
	}
	if x2 < x1 {
		x1, x2 = x2, x1
	}
	for row := y1; row <= y2; row++ {
		for col := x1; col <= x2; col++ {
			if cp := s.GetCell(col, row); cp != nil {
				st := cp.Style
				if st == tcell.StyleDefault {
					st = defStyle
				}
				st = st.Reverse(sel)
				cp.Style = st
				s.PutCell(col, row, cp)
			}
		}
	}
}