mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Don't use next-line and previous-line in non-interactive ways.
- it messes up in visual-line-mode Fixes #10
This commit is contained in:
parent
466d8bd4f8
commit
f7d393d46e
32
features/edit-lines.feature
Normal file
32
features/edit-lines.feature
Normal file
@ -0,0 +1,32 @@
|
||||
Feature: Switching from a multiline region to multiple cursors
|
||||
|
||||
Scenario: Single line region
|
||||
When I insert "hello there"
|
||||
And I select "there"
|
||||
And I press "C-S-c C-S-c"
|
||||
Then I should have one cursor
|
||||
|
||||
Scenario: Edit lines
|
||||
When I insert:
|
||||
"""
|
||||
hello
|
||||
there
|
||||
"""
|
||||
And I go to the front of the word "hello"
|
||||
And I set the mark
|
||||
And I go to the front of the word "there"
|
||||
And I press "C-S-c C-S-c"
|
||||
Then I should have 2 cursors
|
||||
|
||||
Scenario: Edit only real lines, even in visual-line-mode
|
||||
Given I turn on visual-line-mode
|
||||
And I insert:
|
||||
"""
|
||||
some very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very very
|
||||
long text
|
||||
"""
|
||||
And I go to the front of the word "some"
|
||||
And I set the mark
|
||||
And I go to the front of the word "long"
|
||||
And I press "C-S-c C-S-c"
|
||||
Then I should have 2 cursors
|
@ -21,6 +21,7 @@
|
||||
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
|
||||
(global-set-key (kbd "M-!") 'mc/mark-all-like-this)
|
||||
(global-set-key (kbd "M-#") 'mc/mark-all-in-region)
|
||||
(global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
|
||||
(global-set-key (kbd "H-SPC") 'set-rectangular-region-anchor)
|
||||
(switch-to-buffer
|
||||
(get-buffer-create "*multiple-cursors*"))
|
||||
|
@ -40,11 +40,11 @@ line point is on."
|
||||
(mc/remove-fake-cursors)
|
||||
(let* ((point-line (line-number-at-pos))
|
||||
(mark-line (progn (exchange-point-and-mark) (line-number-at-pos)))
|
||||
(navigation-func (if (< point-line mark-line) 'previous-line 'next-line)))
|
||||
(direction (if (< point-line mark-line) :up :down)))
|
||||
(deactivate-mark)
|
||||
(while (not (eq (line-number-at-pos) point-line))
|
||||
(mc/create-fake-cursor-at-point)
|
||||
(funcall navigation-func))
|
||||
(if (eq direction :up) (forward-line -1) (forward-line 1)))
|
||||
(multiple-cursors-mode)))
|
||||
|
||||
;;;###autoload
|
||||
|
Loading…
x
Reference in New Issue
Block a user