Revert "Support unmarking with no region. Change mc/mark-lines to preserve point."

This reverts commit 2d6ffce4c94cdbec1ea8ec086ea346423bafcdf1.

Fixes #201
This commit is contained in:
Magnar Sveen 2015-05-29 08:03:15 +02:00
parent 142fdd6534
commit 2588ccef69

View File

@ -127,14 +127,14 @@ Use like case-fold-search, don't recommend setting it globally.")
With negative ARG, delete the last one instead. With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next." With zero ARG, skip the last one and mark next."
(interactive "p") (interactive "p")
(if (< arg 0) (if (region-active-p)
(let ((cursor (mc/furthest-cursor-after-point))) (if (< arg 0)
(if cursor (let ((cursor (mc/furthest-cursor-after-point)))
(mc/remove-fake-cursor cursor) (if cursor
(error "No cursors to be unmarked"))) (mc/remove-fake-cursor cursor)
(if (region-active-p) (error "No cursors to be unmarked")))
(mc/mark-more-like-this (= arg 0) 'forwards) (mc/mark-more-like-this (= arg 0) 'forwards))
(mc/mark-lines arg 'forwards))) (mc/mark-lines arg 'forwards))
(mc/maybe-multiple-cursors-mode)) (mc/maybe-multiple-cursors-mode))
;;;###autoload ;;;###autoload
@ -155,14 +155,14 @@ With zero ARG, skip the last one and mark next."
With negative ARG, delete the last one instead. With negative ARG, delete the last one instead.
With zero ARG, skip the last one and mark next." With zero ARG, skip the last one and mark next."
(interactive "p") (interactive "p")
(if (< arg 0) (if (region-active-p)
(let ((cursor (mc/furthest-cursor-before-point))) (if (< arg 0)
(if cursor (let ((cursor (mc/furthest-cursor-before-point)))
(mc/remove-fake-cursor cursor) (if cursor
(error "No cursors to be unmarked"))) (mc/remove-fake-cursor cursor)
(if (region-active-p) (error "No cursors to be unmarked")))
(mc/mark-more-like-this (= arg 0) 'backwards) (mc/mark-more-like-this (= arg 0) 'backwards))
(mc/mark-lines arg 'backwards))) (mc/mark-lines arg 'backwards))
(mc/maybe-multiple-cursors-mode)) (mc/maybe-multiple-cursors-mode))
;;;###autoload ;;;###autoload
@ -179,16 +179,12 @@ With zero ARG, skip the last one and mark next."
(defun mc/mark-lines (num-lines direction) (defun mc/mark-lines (num-lines direction)
(dotimes (i num-lines) (dotimes (i num-lines)
(mc/save-excursion (mc/create-fake-cursor-at-point)
(let ((furthest-cursor (ecase direction (ecase direction
(forwards (mc/furthest-cursor-after-point)) (forwards (loop do (next-logical-line 1 nil)
(backwards (mc/furthest-cursor-before-point))))) while (mc/all-fake-cursors (point) (1+ (point)))))
(if (overlayp furthest-cursor) (backwards (loop do (previous-logical-line 1 nil)
(goto-char (overlay-get furthest-cursor 'point)))) while (mc/all-fake-cursors (point) (1+ (point))))))))
(ecase direction
(forwards (next-logical-line 1 nil))
(backwards (previous-logical-line 1 nil)))
(mc/create-fake-cursor-at-point))))
;;;###autoload ;;;###autoload
(defun mc/mark-next-lines (arg) (defun mc/mark-next-lines (arg)