@@ -1211,6 +1211,14 @@ func (h *BufPane) FindNext() bool {
1211
1211
match , found , err := h .Buf .FindNext (h .Buf .LastSearch , h .Buf .Start (), h .Buf .End (), searchLoc , true , h .Buf .LastSearchRegex )
1212
1212
if err != nil {
1213
1213
InfoBar .Error (err )
1214
+ } else if found && searchLoc == match [0 ] && match [0 ] == match [1 ] {
1215
+ // skip empty match at present cursor location
1216
+ if searchLoc == h .Buf .End () {
1217
+ searchLoc = h .Buf .Start ()
1218
+ } else {
1219
+ searchLoc = searchLoc .Move (1 , h .Buf )
1220
+ }
1221
+ match , found , _ = h .Buf .FindNext (h .Buf .LastSearch , h .Buf .Start (), h .Buf .End (), searchLoc , true , h .Buf .LastSearchRegex )
1214
1222
}
1215
1223
if found {
1216
1224
h .Cursor .SetSelectionStart (match [0 ])
@@ -1240,6 +1248,14 @@ func (h *BufPane) FindPrevious() bool {
1240
1248
match , found , err := h .Buf .FindNext (h .Buf .LastSearch , h .Buf .Start (), h .Buf .End (), searchLoc , false , h .Buf .LastSearchRegex )
1241
1249
if err != nil {
1242
1250
InfoBar .Error (err )
1251
+ } else if found && searchLoc == match [0 ] && match [0 ] == match [1 ] {
1252
+ // skip empty match at present cursor location
1253
+ if searchLoc == h .Buf .Start () {
1254
+ searchLoc = h .Buf .End ()
1255
+ } else {
1256
+ searchLoc = searchLoc .Move (- 1 , h .Buf )
1257
+ }
1258
+ match , found , _ = h .Buf .FindNext (h .Buf .LastSearch , h .Buf .Start (), h .Buf .End (), searchLoc , false , h .Buf .LastSearchRegex )
1243
1259
}
1244
1260
if found {
1245
1261
h .Cursor .SetSelectionStart (match [0 ])
0 commit comments