Skip to content

Commit

Permalink
WIP: match-next-like-this with multiple lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Book-reader committed Sep 7, 2024
1 parent fe0e057 commit 4947968
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions extensions/multiple-cursors/multiple-cursors.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
:search-next-matched
:isearch-abort
:make-add-char-callback)
(:import-from :lem/buffer/internal
:point-linum)
(:export :add-cursors-to-next-line
:add-cursors-to-previous-line
:mark-next-like-this)
Expand Down Expand Up @@ -63,13 +65,14 @@
#'search-backward
#'search-forward)
(points-to-string start end))

(dolist (point (buffer-cursors (current-buffer)))
(with-point ((point point))
(if (search-next-matched point 1)
(progn (setf cursor (make-fake-cursor point))
(setf (point-charpos point) (- (point-charpos point) (- (point-charpos end) (point-charpos start))))
(set-cursor-mark cursor point))
(progn
(setf cursor (make-fake-cursor point))
(setf (point-linum point) (- (point-linum point) (- (point-linum end) (point-linum start))))
(setf (point-charpos point) (- (point-charpos point) (- (point-charpos end) (point-charpos start))))
(set-cursor-mark cursor point))
(message "No more matches"))))
(isearch-abort))

Expand Down

0 comments on commit 4947968

Please sign in to comment.