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/goruby/vendor/github.com/goruby/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
    
func (o *opSearch) SearchMode(dir int) bool {
	if o.width == 0 {
		return false
	}
	alreadyInMode := o.inMode
	o.inMode = true
	o.dir = dir
	o.source = o.history.current
	if alreadyInMode {
		o.search(false)
	} else {
		o.SearchRefresh(-1)
	}
	return true
}