// CursorRight move to right on the current line.
971344
func (b *Buffer) CursorRight(count int) {
	l := b.Document().GetCursorRightPosition(count)
	b.cursorPosition += l
	return
}
1127415
func (c *Cursor) First() ([]byte, []byte) {
	if c.Reverse {
		return c.C.Last()
	}

	return c.C.First()
}
888986
func (c *Cursor) Back(n int) {
	fmt.Fprintf(c.Out, "\x1b[%dD", n)
}
1190360
func (c *Cursor) Forward(n int) {
	fmt.Fprintf(c.Out, "\x1b[%dC", n)
}
1251847
func (tp *TicketPool) Cursor() int64 {
	tp.mtx.RLock()
	defer tp.mtx.RUnlock()
	return tp.cursor
}
296111
func (w *Window) SetMousePosition(v pixel.Vec) {
	mainthread.Call(func() {
		if (v.X >= 0 && v.X <= w.bounds.W()) &&
			(v.Y >= 0 && v.Y <= w.bounds.H()) {
			w.window.SetCursorPos(
				v.X+w.bounds.Min.X,
				(w.bounds.H()-v.Y)+w.bounds.Min.Y,
			)
			w.prevInp.mouse = v
			w.currInp.mouse = v
			w.tempInp.mouse = v
		}
	})
}
1067273
func GoLineBeginning(buf *Buffer) {
	x := []rune(buf.Document().TextBeforeCursor())
	buf.CursorLeft(len(x))
}
22159
func (c *Cursor) Move(x int, y int) {
	fmt.Fprintf(c.Out, "\x1b[%d;%df", x, y)
}
157064
func (s *Hits) SetCursor(v string) *Hits {
	s.Cursor = &v
	return s
}
375849
func moveCursorUp(printTo io.Writer, numLines int) {
	if numLines > 0 {
		fmt.Fprintf(printTo, "\033[%dA", numLines)
	}
}
701929
func (c *cursor) Next() (key, value []byte) {
	return (*bbolt.Cursor)(c).Next()
}
1264108
func SetCursorVisibility(visible bool) {
	if visible {
		sdl.ShowCursor(sdl.ENABLE)
	} else {
		sdl.ShowCursor(sdl.DISABLE)
	}
}
1100551
func (w *VT100Writer) CursorUp(n int) {
	if n == 0 {
		return
	} else if n < 0 {
		w.CursorDown(-n)
		return
	}
	s := strconv.Itoa(n)
	w.WriteRaw([]byte{0x1b, '['})
	w.WriteRaw([]byte(s))
	w.WriteRaw([]byte{'A'})
	return
}
212603
func newCursor(client *Client, fn requestFn, limit int) (c *cursor, err error) {
	return &cursor{client: client, requestFn: fn, limit: limit}, nil
}
1321624
func (v *View) SetCursor(x, y int) error {
	maxX, maxY := v.Size()
	if x < 0 || x >= maxX || y < 0 || y >= maxY {
		return errors.New("invalid point")
	}
	v.cx = x
	v.cy = y
	return nil
}
1049496
func CursorToOffset(cursor ConnectionCursor) (int, error) {
	str := ""
	b, err := base64.StdEncoding.DecodeString(string(cursor))
	if err == nil {
		str = string(b)
	}
	str = strings.Replace(str, PREFIX, "", -1)
	offset, err := strconv.Atoi(str)
	if err != nil {
		return 0, errors.New("Invalid cursor")
	}
	return offset, nil
}
20976
func (r *RuneBuffer) CursorPos() image.Point {
	if r.width == 0 {
		return image.ZP
	}

	sp := r.SplitByLine()
	var x, y int
	remaining := r.idx
	for _, l := range sp {
		if utf8.RuneCountInString(l) < remaining {
			y++
			remaining -= utf8.RuneCountInString(l) + 1
		} else {
			x = remaining
			break
		}
	}
	return image.Pt(stringWidth(string(r.buf[:x])), y)
}