@@ -957,7 +957,8 @@ any error conditions."
957
957
(let* ((res (evil-ex-split-search-pattern pattern-string direction))
958
958
(pat (pop res))
959
959
(offset (pop res))
960
- (next-pat (pop res)))
960
+ (next-pat (pop res))
961
+ (orig-pat pat))
961
962
; ; use last pattern if no new pattern has been specified
962
963
(if (not (zerop (length pat)))
963
964
(setq pat (evil-ex-make-search-pattern pat))
@@ -982,15 +983,21 @@ any error conditions."
982
983
((zerop (length next-pat))
983
984
(evil-ex-search-goto-offset offset)
984
985
(throw 'done (list search-result pat offset)))
985
- ; ; next pattern but empty
986
+ ; ; single `?' or `/' means repeat last pattern and finish
986
987
((= 1 (length next-pat))
987
988
(evil-ex-search-goto-offset offset)
988
- (throw 'done (list 'empty-pattern pat offset)))
989
+ (setq count 1
990
+ pattern-string orig-pat
991
+ direction (if (string= " /" next-pat) 'forward 'backward )))
989
992
; ; next non-empty pattern, next search iteration
990
993
(t
991
994
(evil-ex-search-goto-offset offset)
992
995
(setq count 1
993
- pattern-string (substring next-pat 1 )
996
+ pattern-string (if (and (<= 2 (length next-pat))
997
+ (member (substring next-pat 0 2 ) '(" //" " ??" )))
998
+ ; ; double `?' or `/' means repeat last pattern
999
+ (concat orig-pat (substring next-pat 1 ))
1000
+ (substring next-pat 1 ))
994
1001
direction (if (= (aref next-pat 0 ) ?/ )
995
1002
'forward
996
1003
'backward )))))))))
0 commit comments