You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: search.go
    path of file: ./repos/comply/vendor/github.com/chzyer/readline
    
    the code of the file until where you have to start completion: package readline

import (
	"bytes"
	"container/list"
	"fmt"
	"io"
)

const (
	S_STATE_FOUND = iota
	S_STATE_FAILING
)

const (
	S_DIR_BCK = iota
	S_DIR_FWD
)

type opSearch struct {
	inMode    bool
	state     int
	dir       int
	source    *list.Element
	w         io.Writer
	buf       *RuneBuffer
	data      []rune
	history   *opHistory
	cfg       *Config
	markStart int
	markEnd   int
	width     int
}

func newOpSearch(w io.Writer, buf *RuneBuffer, history *opHistory, cfg *Config, width int) *opSearch {
	return &opSearch{
		w:       w,
		buf:     buf,
		cfg:     cfg,
		history: history,
		width:   width,
	}
}

func (o *opSearch) OnWidthChange(newWidth int) {
	o.width = newWidth
}

func (o *opSearch) IsSearchMode() bool {
	return o.inMode
}

f
    
func (o *opSearch) SearchRefresh(x int) {
	if x == -2 {
		o.state = S_STATE_FAILING
	} else if x >= 0 {
		o.state = S_STATE_FOUND
	}
	if x < 0 {
		x = o.buf.idx
	}
	x = o.buf.CurrentWidth(x)
	x += o.buf.PromptLen()
	x = x % o.width

	if o.markStart > 0 {
		o.buf.SetStyle(o.markStart, o.markEnd, "4")
	}

	lineCnt := o.buf.CursorLineCount()
	buf := bytes.NewBuffer(nil)
	buf.Write(bytes.Repeat([]byte("\n"), lineCnt))
	buf.WriteString("\033[J")
	if o.state == S_STATE_FAILING {
		buf.WriteString("failing ")
	}
	if o.dir == S_DIR_BCK {
		buf.WriteString("bck")
	} else if o.dir == S_DIR_FWD {
		buf.WriteString("fwd")
	}
	buf.WriteString("-i-search: ")
	buf.WriteString(string(o.data))         // keyword
	buf.WriteString("\033[4m \033[0m")      // _
	fmt.Fprintf(buf, "\r\033[%dA", lineCnt) // move prev
	if x > 0 {
		fmt.Fprintf(buf, "\033[%dC", x) // move forward
	}
	o.w.Write(buf.Bytes())
}