// returns the distance between two locations in bytes
returns the distance between two locations in bytes
// returns the distance between two locations in bytes
func (a cursor_location) distance(b cursor_location) int {
	s := 1
	if b.line_num < a.line_num {
		a, b = b, a
		s = -1
	} else if a.line_num == b.line_num && b.boffset < a.boffset {
		a, b = b, a
		s = -1
	}
	n := 0
	for a.line != b.line {
		n += len(a.line.data) - a.boffset + 1
		a.line = a.line.next
		a.boffset = 0
	}
	n += b.boffset - a.boffset
	return n * s
}
func ( a cursor_location ) distance ( b cursor_location ) int { s := 1 if b . line_num < a . line_num { a , b = b , a s = - 1 } else if a . line_num == b . line_num && b . boffset < a . boffset { a , b = b , a s = - 1 } n := 0 for a . line != b . line { n += len ( a . line . data ) - a . boffset + 1 a . line = a . line . next a . boffset = 0 } n += b . boffset - a . boffset return n * s }
returns the distance between two locations in bytes
returns the distance between two locations in bytes