diff --git a/features/mark-more.feature b/features/mark-more.feature index c8cd3ff..8ca86f7 100644 --- a/features/mark-more.feature +++ b/features/mark-more.feature @@ -113,3 +113,22 @@ Feature: Marking multiple parts of the buffer _ccc """ + Scenario: Increasing number of cursors without an active region + When I insert: + """ + aaa + bbb + ccc + """ + And I go to the front of the word "bbb" + And I press "C->" + And I press "C-<" + And i press "C-f" + And I type "_" + Then I should have 3 cursors + And I should see: + """ + a_aa + b_bb + c_cc + """ diff --git a/mc-mark-more.el b/mc-mark-more.el index 8dd4bc6..7d722b0 100644 --- a/mc-mark-more.el +++ b/mc-mark-more.el @@ -145,8 +145,10 @@ With zero ARG, skip the last one and mark next." (dotimes (i num-lines) (mc/create-fake-cursor-at-point) (ecase direction - (forwards (next-line 1 nil)) - (backwards (previous-line 1 nil))))) + (forwards (loop do (next-line 1 nil) + while (mc/all-fake-cursors (point) (1+ (point))))) + (backwards (loop do (previous-line 1 nil) + while (mc/all-fake-cursors (point) (1+ (point)))))))) ;;;###autoload (defun mc/mark-next-lines (arg)