[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/multiple-cursors f7d393d 128/434: Don't use next-line and
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/multiple-cursors f7d393d 128/434: Don't use next-line and previous-line in non-interactive ways. |
Date: |
Sat, 7 Aug 2021 09:20:10 -0400 (EDT) |
branch: elpa/multiple-cursors
commit f7d393d46e081b4cf23fa9836be6fe8bb6f4f3d4
Author: Magnar Sveen <magnars@gmail.com>
Commit: Magnar Sveen <magnars@gmail.com>
Don't use next-line and previous-line in non-interactive ways.
- it messes up in visual-line-mode
Fixes #10
---
features/edit-lines.feature | 32 ++++++++++++++++++++++++++++++++
features/support/env.el | 1 +
mc-edit-lines.el | 4 ++--
3 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/features/edit-lines.feature b/features/edit-lines.feature
new file mode 100644
index 0000000..de62c80
--- /dev/null
+++ b/features/edit-lines.feature
@@ -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
diff --git a/features/support/env.el b/features/support/env.el
index 78b7297..652016a 100644
--- a/features/support/env.el
+++ b/features/support/env.el
@@ -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*"))
diff --git a/mc-edit-lines.el b/mc-edit-lines.el
index 0a923f1..de6d343 100644
--- a/mc-edit-lines.el
+++ b/mc-edit-lines.el
@@ -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
- [nongnu] elpa/multiple-cursors ef2226b 116/434: Consolidate kill-ring entries when exiting multiple-cursors-mode, (continued)
- [nongnu] elpa/multiple-cursors ef2226b 116/434: Consolidate kill-ring entries when exiting multiple-cursors-mode, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d5a9d57 132/434: Add minibuffer-complete-and-exit to default run-once list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b48e2b7 137/434: mc/edit-lines: Don't include the 'invisible' line, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors ae0033f 140/434: Protect post-command-hook from errors to avoids undead cursors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors fcbb7a4 152/434: Make mc/cycle-forward and mc/cycle-backward loop around by default., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 876937b 153/434: Use (interactive "P") instead of the weird (but equivalent) (interactive (list prefix-arg)), ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1ec78e1 162/434: Don't let mc/mark-lines create 'double' cursors., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 1074c88 178/434: Added mc/mark-all-like-this-dwim, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 9582c72 204/434: Add mc/insert-numbers, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d534132 122/434: Remove todo.org - use issues instead, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors f7d393d 128/434: Don't use next-line and previous-line in non-interactive ways.,
ELPA Syncer <=
- [nongnu] elpa/multiple-cursors fc59b63 131/434: Fix typo, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors d98b85b 138/434: Bump to 1.1.2, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6e9ea1a 149/434: Merge pull request #20 from tkf/diff-friendly-save-lists, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6d4979d 144/434: Bump to 1.1.3, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors b3ca408 171/434: Have to require 'cl for now, because of count-if., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a6984a1 203/434: Merge pull request #53 from oneself/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors a37e02b 177/434: Add new mc-commands to default run-once list., ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 6339657 192/434: Fix byte-compilation warnings, and avoid unnecessary use of "eval", ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 641eb68 212/434: Can use mc/reverse-regions w/o region or cursors, ELPA Syncer, 2021/08/07
- [nongnu] elpa/multiple-cursors 0ee76bf 214/434: Add mc/add-cursor-on-click, ELPA Syncer, 2021/08/07