Merge pull request #125 from kyanagi/fix-cycle-cursors-on-edge

Fix cycle-cursor behavior
This commit is contained in:
Magnar Sveen 2014-01-05 02:59:22 -08:00
commit 5cd6ddf788
2 changed files with 16 additions and 2 deletions

View File

@ -166,9 +166,23 @@ Feature: Multiple cursors core
And I press "C-v" And I press "C-v"
Then the cursor should be at point "8" Then the cursor should be at point "8"
Scenario: Looping forwards around cursors including one at point-max
Given I have cursors at "_" in "1_34_67_"
And I press "C-f"
And I press "C-v"
And I press "C-v"
And I press "C-v"
Then the cursor should be at point "3"
Scenario: Looping backwards around cursors Scenario: Looping backwards around cursors
Given I have cursors at "_" in "1_34567_9" Given I have cursors at "_" in "1_34567_9"
And I press "M-v" And I press "M-v"
And I press "M-v" And I press "M-v"
Then the cursor should be at point "2" Then the cursor should be at point "2"
Scenario: Looping backwards around cursors including one at point-min
Given I have cursors at "_" in "_234_67_9"
And I press "M-v"
And I press "M-v"
And I press "M-v"
Then the cursor should be at point "1"

View File

@ -32,7 +32,7 @@
(defun mc/next-fake-cursor-after-point () (defun mc/next-fake-cursor-after-point ()
(let ((pos (point)) (let ((pos (point))
(next-pos (point-max)) (next-pos (1+ (point-max)))
next) next)
(mc/for-each-fake-cursor (mc/for-each-fake-cursor
(let ((cursor-pos (overlay-get cursor 'point))) (let ((cursor-pos (overlay-get cursor 'point)))
@ -44,7 +44,7 @@
(defun mc/prev-fake-cursor-before-point () (defun mc/prev-fake-cursor-before-point ()
(let ((pos (point)) (let ((pos (point))
(prev-pos (point-min)) (prev-pos (1- (point-min)))
prev) prev)
(mc/for-each-fake-cursor (mc/for-each-fake-cursor
(let ((cursor-pos (overlay-get cursor 'point))) (let ((cursor-pos (overlay-get cursor 'point)))