mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Merge pull request #241 from YoungFrog/fix-#230
* mc-mark-more.el (mc/mark-all-in-region-regexp): Don't infloop when …
This commit is contained in:
commit
8297f1f210
@ -347,7 +347,7 @@ With zero ARG, skip the last one and mark next."
|
|||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun mc/mark-all-in-region-regexp (beg end)
|
(defun mc/mark-all-in-region-regexp (beg end)
|
||||||
"Find and mark all the parts in the region matching the given regexp"
|
"Find and mark all the parts in the region matching the given regexp."
|
||||||
(interactive "r")
|
(interactive "r")
|
||||||
(let ((search (read-regexp "Mark regexp in region: "))
|
(let ((search (read-regexp "Mark regexp in region: "))
|
||||||
(case-fold-search nil))
|
(case-fold-search nil))
|
||||||
@ -356,9 +356,17 @@ With zero ARG, skip the last one and mark next."
|
|||||||
(progn
|
(progn
|
||||||
(mc/remove-fake-cursors)
|
(mc/remove-fake-cursors)
|
||||||
(goto-char beg)
|
(goto-char beg)
|
||||||
(while (search-forward-regexp search end t)
|
(let ((lastmatch))
|
||||||
|
(while (and (< (point) end) ; can happen because of (forward-char)
|
||||||
|
(search-forward-regexp search end t))
|
||||||
(push-mark (match-beginning 0))
|
(push-mark (match-beginning 0))
|
||||||
(mc/create-fake-cursor-at-point))
|
(mc/create-fake-cursor-at-point)
|
||||||
|
(setq lastmatch (point))
|
||||||
|
(when (= (point) (match-beginning 0))
|
||||||
|
(forward-char)))
|
||||||
|
(when lastmatch (goto-char lastmatch)))
|
||||||
|
(when (> (mc/num-cursors) 0)
|
||||||
|
(goto-char (match-end 0)))
|
||||||
(let ((first (mc/furthest-cursor-before-point)))
|
(let ((first (mc/furthest-cursor-before-point)))
|
||||||
(if (not first)
|
(if (not first)
|
||||||
(error "Search failed for %S" search)
|
(error "Search failed for %S" search)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user