MCPcopy Create free account
hub / github.com/cogentcore/core / iSearchKeyInput

Method iSearchKeyInput

texteditor/find.go:165–184  ·  view source on GitHub ↗

iSearchKeyInput is an emacs-style interactive search mode -- this is called when keys are typed while in search mode

(kt events.Event)

Source from the content-addressed store, hash-verified

163// iSearchKeyInput is an emacs-style interactive search mode -- this is called
164// when keys are typed while in search mode
165func (ed *Editor) iSearchKeyInput(kt events.Event) {
166 kt.SetHandled()
167 r := kt.KeyRune()
168 // if ed.ISearch.Find == PrevISearchString { // undo starting point
169 // ed.ISearch.Find = ""
170 // }
171 if unicode.IsUpper(r) { // todo: more complex
172 ed.ISearch.useCase = true
173 }
174 ed.ISearch.Find += string(r)
175 ed.iSearchMatches()
176 sz := len(ed.ISearch.Matches)
177 if sz == 0 {
178 ed.ISearch.pos = -1
179 ed.iSearchEvent()
180 return
181 }
182 ed.iSearchNextMatch(ed.CursorPos)
183 ed.NeedsRender()
184}
185
186// iSearchBackspace gets rid of one item in search string
187func (ed *Editor) iSearchBackspace() {

Callers 2

keyInputMethod · 0.95
keyInputInsertRuneMethod · 0.95

Calls 6

iSearchMatchesMethod · 0.95
iSearchEventMethod · 0.95
iSearchNextMatchMethod · 0.95
NeedsRenderMethod · 0.80
SetHandledMethod · 0.65
KeyRuneMethod · 0.65

Tested by

no test coverage detected