Skip lines in rectangular-region-mode that are too short for the rectangle.

This commit is contained in:
Magnar Sveen 2012-07-21 08:45:51 +02:00
parent 56d037319a
commit 05125618aa

View File

@ -39,17 +39,18 @@
(left-column (if (< point-column anchor-column) point-column anchor-column))
(right-column (if (> point-column anchor-column) point-column anchor-column))
(navigation-func (if (< point-line anchor-line) 'next-line 'previous-line)))
(move-to-column anchor-column t)
(move-to-column anchor-column)
(set-mark (point))
(move-to-column point-column t)
(move-to-column point-column)
(mc/save-excursion
(while (not (= anchor-line (line-number-at-pos)))
(funcall navigation-func)
(move-to-column right-column t)
(move-to-column anchor-column t)
(move-to-column anchor-column)
(when (= anchor-column (current-column))
(set-mark (point))
(move-to-column point-column t)
(mc/create-fake-cursor-at-point)))))
(move-to-column point-column)
(when (= point-column (current-column))
(mc/create-fake-cursor-at-point)))))))
(defun rrm/switch-to-multiple-cursors (&rest forms)
(interactive)