@@ -966,7 +966,7 @@ any error conditions."
966
966
offset (or offset evil-ex-search-offset)))
967
967
(when (zerop (length pat))
968
968
(throw 'done (list 'empty-pattern pat offset)))
969
- (let (search-result)
969
+ (let (new-dir repeat-last search-result)
970
970
(while (> count 0 )
971
971
(let ((result (evil-ex-find-next pat direction
972
972
(not evil-search-wrap))))
@@ -986,21 +986,21 @@ any error conditions."
986
986
; ; single `?' or `/' means repeat last pattern and finish
987
987
((= 1 (length next-pat))
988
988
(evil-ex-search-goto-offset offset)
989
- (setq count 1
989
+ (setq new-dir (if (string= " /" next-pat) 'forward 'backward )
990
+ count (if (eq direction new-dir) 1 2 )
990
991
pattern-string orig-pat
991
- direction ( if ( string= " / " next-pat) 'forward 'backward ) ))
992
+ direction new-dir ))
992
993
; ; next non-empty pattern, next search iteration
993
994
(t
994
995
(evil-ex-search-goto-offset offset)
995
- (setq count 1
996
- pattern-string (if (and (<= 2 (length next-pat))
997
- (member (substring next-pat 0 2 ) '(" //" " ??" )))
998
- ; ; double `?' or `/' means repeat last pattern
996
+ (setq new-dir (if (= (aref next-pat 0 ) ?/ ) 'forward 'backward )
997
+ repeat-last (and (<= 2 (length next-pat))
998
+ (member (substring next-pat 0 2 ) '(" //" " ??" )))
999
+ count (if (or (eq direction new-dir) (not repeat-last)) 1 2 )
1000
+ pattern-string (if repeat-last
999
1001
(concat orig-pat (substring next-pat 1 ))
1000
1002
(substring next-pat 1 ))
1001
- direction (if (= (aref next-pat 0 ) ?/ )
1002
- 'forward
1003
- 'backward )))))))))
1003
+ direction new-dir))))))))
1004
1004
1005
1005
(defun evil-ex-search-update-pattern (_beg _end _range )
1006
1006
" Update the current search pattern."
0 commit comments