Example #1
0
File: view.go Project: kisielk/vigo
func (s Selection) includes(c buffer.Cursor) bool {
	if s.Type == SelectionNone {
		return false
	}

	start, end := buffer.SortCursors(s.Start, s.End)
	inc := false

	switch s.Type {
	case SelectionChar:
		inc = (start.Before(c) || start.Equals(c)) && (c.Before(end) || c.Equals(end))
	case SelectionLine:
		inc = start.LineNum <= c.LineNum && c.LineNum <= end.LineNum
	case SelectionBlock:
		// TODO
		panic("not implemented")
	}

	return inc
}