}
if messenger.response == "" {
- v.cursor.ResetSelection()
+ v.Cursor.ResetSelection()
// We don't end the search though
return
}
}
var str string
var charPos int
- text := v.buf.String()
+ text := v.Buf.String()
if down {
str = text[searchStart:]
charPos = searchStart
str = text[:searchStart]
}
r, err := regexp.Compile(searchStr)
+ if settings["ignorecase"].(bool) {
+ r, err = regexp.Compile("(?i)" + searchStr)
+ }
if err != nil {
return
}
matches = r.FindAllStringIndex(text, -1)
charPos = 0
if matches == nil {
- v.cursor.ResetSelection()
+ v.Cursor.ResetSelection()
return
}
match = matches[0]
}
- v.cursor.curSelection[0] = charPos + match[0]
- v.cursor.curSelection[1] = charPos + match[1]
- v.cursor.x, v.cursor.y = FromCharPos(charPos+match[1]-1, v.buf)
+ if match[0] == match[1] {
+ return
+ }
+
+ v.Cursor.curSelection[0] = charPos + match[0]
+ v.Cursor.curSelection[1] = charPos + match[1]
+ v.Cursor.x, v.Cursor.y = FromCharPos(charPos+match[1]-1, v.Buf)
if v.Relocate() {
v.matches = Match(v)
}