@@ -1211,6 +1211,14 @@ func (h *BufPane) FindNext() bool {
12111211 match , found , err := h .Buf .FindNext (h .Buf .LastSearch , h .Buf .Start (), h .Buf .End (), searchLoc , true , h .Buf .LastSearchRegex )
12121212 if err != nil {
12131213 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 )
12141222 }
12151223 if found {
12161224 h .Cursor .SetSelectionStart (match [0 ])
@@ -1240,6 +1248,14 @@ func (h *BufPane) FindPrevious() bool {
12401248 match , found , err := h .Buf .FindNext (h .Buf .LastSearch , h .Buf .Start (), h .Buf .End (), searchLoc , false , h .Buf .LastSearchRegex )
12411249 if err != nil {
12421250 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 )
12431259 }
12441260 if found {
12451261 h .Cursor .SetSelectionStart (match [0 ])
0 commit comments