mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
mc/edit-lines: Don't include the 'invisible' line
- when marking a region from bottom to top there is an invisible line in the region if mark is at the beginning of the line. - don't count that line when doing mc/edit-lines
This commit is contained in:
parent
d7263f21f0
commit
b48e2b7682
@ -18,6 +18,18 @@ Feature: Switching from a multiline region to multiple cursors
|
|||||||
And I press "C-S-c C-S-c"
|
And I press "C-S-c C-S-c"
|
||||||
Then I should have 2 cursors
|
Then I should have 2 cursors
|
||||||
|
|
||||||
|
Scenario: Edit lines from bottom up
|
||||||
|
When I insert:
|
||||||
|
"""
|
||||||
|
hello
|
||||||
|
there
|
||||||
|
"""
|
||||||
|
And I go to the front of the word "there"
|
||||||
|
And I set the mark
|
||||||
|
And I go to the front of the word "hello"
|
||||||
|
And I press "C-S-c C-S-c"
|
||||||
|
Then I should have one cursor
|
||||||
|
|
||||||
Scenario: Edit only real lines, even in visual-line-mode
|
Scenario: Edit only real lines, even in visual-line-mode
|
||||||
Given I turn on visual-line-mode
|
Given I turn on visual-line-mode
|
||||||
And I insert:
|
And I insert:
|
||||||
|
@ -38,13 +38,18 @@ line point is on."
|
|||||||
(when (not (use-region-p))
|
(when (not (use-region-p))
|
||||||
(error "Mark a set of lines first."))
|
(error "Mark a set of lines first."))
|
||||||
(mc/remove-fake-cursors)
|
(mc/remove-fake-cursors)
|
||||||
(let* ((point-line (line-number-at-pos))
|
(let* ((col (current-column))
|
||||||
|
(point-line (line-number-at-pos))
|
||||||
(mark-line (progn (exchange-point-and-mark) (line-number-at-pos)))
|
(mark-line (progn (exchange-point-and-mark) (line-number-at-pos)))
|
||||||
(direction (if (< point-line mark-line) :up :down)))
|
(direction (if (< point-line mark-line) :up :down)))
|
||||||
(deactivate-mark)
|
(deactivate-mark)
|
||||||
|
(when (and (eq direction :up) (bolp))
|
||||||
|
(forward-line -1)
|
||||||
|
(move-to-column col))
|
||||||
(while (not (eq (line-number-at-pos) point-line))
|
(while (not (eq (line-number-at-pos) point-line))
|
||||||
(mc/create-fake-cursor-at-point)
|
(mc/create-fake-cursor-at-point)
|
||||||
(if (eq direction :up) (forward-line -1) (forward-line 1)))
|
(if (eq direction :up) (forward-line -1) (forward-line 1))
|
||||||
|
(move-to-column col))
|
||||||
(multiple-cursors-mode)))
|
(multiple-cursors-mode)))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
|
Loading…
x
Reference in New Issue
Block a user