mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2026-02-04 14:22:24 +00:00
Tweak mc/mark-all-like-this-dwim and add tests
This commit is contained in:
94
features/mark-all-dwim-html.feature
Normal file
94
features/mark-all-dwim-html.feature
Normal file
@@ -0,0 +1,94 @@
|
||||
Feature: Mark all do-what-I-mean (html)
|
||||
|
||||
Background:
|
||||
Given I turn on html-mode
|
||||
And I turn on delete-selection-mode
|
||||
And I insert:
|
||||
"""
|
||||
<body>
|
||||
<div class="abc"> def </div>
|
||||
<div class="ghi"> jkl </div>
|
||||
</body>
|
||||
"""
|
||||
|
||||
Scenario: Marks tags in html-mode, from front
|
||||
When I go to the front of the word "abc"
|
||||
And I press "M-b"
|
||||
And I press "M-b"
|
||||
And I press "M-$"
|
||||
And I type "h1"
|
||||
Then I should see:
|
||||
"""
|
||||
<body>
|
||||
<h1 class="abc"> def </h1>
|
||||
<div class="ghi"> jkl </div>
|
||||
</body>
|
||||
"""
|
||||
|
||||
Scenario: Marks tags in html-mode, from back
|
||||
When I go to the end of the word "jkl"
|
||||
And I press "M-f"
|
||||
And I press "M-$"
|
||||
And I type "h1"
|
||||
Then I should see:
|
||||
"""
|
||||
<body>
|
||||
<div class="abc"> def </div>
|
||||
<h1 class="ghi"> jkl </h1>
|
||||
</body>
|
||||
"""
|
||||
|
||||
Scenario: Marks tags in html-mode, from outside front
|
||||
When I go to the front of the word "abc"
|
||||
And I press "M-b"
|
||||
And I press "M-b"
|
||||
And I press "C-b"
|
||||
And I press "M-$"
|
||||
And I type "h1"
|
||||
Then I should see:
|
||||
"""
|
||||
<body>
|
||||
<h1 class="abc"> def </h1>
|
||||
<div class="ghi"> jkl </div>
|
||||
</body>
|
||||
"""
|
||||
|
||||
Scenario: Marks tags in html-mode, from outside back
|
||||
When I go to the end of the word "jkl"
|
||||
And I press "M-f"
|
||||
And I press "C-f"
|
||||
And I press "M-$"
|
||||
And I type "h1"
|
||||
Then I should see:
|
||||
"""
|
||||
<body>
|
||||
<div class="abc"> def </div>
|
||||
<h1 class="ghi"> jkl </h1>
|
||||
</body>
|
||||
"""
|
||||
|
||||
Scenario: Marks words in html-mode
|
||||
When I go to the front of the word "abc"
|
||||
And I press "M-$"
|
||||
And I type "def"
|
||||
Then I should see:
|
||||
"""
|
||||
<body>
|
||||
<div class="def"> def </div>
|
||||
<div class="ghi"> jkl </div>
|
||||
</body>
|
||||
"""
|
||||
|
||||
Scenario: Marks words in html-mode
|
||||
When I go to the front of the word "abc"
|
||||
And I press "M-$"
|
||||
And I type "def"
|
||||
And I press "M-$"
|
||||
And I type "hah"
|
||||
Then I should see:
|
||||
"""
|
||||
<body>
|
||||
<div class="hah"> hah </div>
|
||||
<div class="ghi"> jkl </div>
|
||||
</body>
|
||||
"""
|
||||
38
features/mark-all-dwim.feature
Normal file
38
features/mark-all-dwim.feature
Normal file
@@ -0,0 +1,38 @@
|
||||
Feature: Mark all do-what-I-mean
|
||||
|
||||
Scenario: Mark symbols in defun
|
||||
Given I turn on emacs-lisp-mode
|
||||
And I turn on delete-selection-mode
|
||||
And I insert:
|
||||
"""
|
||||
(defun abc (ghi) (message ghi))
|
||||
(defun def (ghi) (message some-other-ghi))
|
||||
"""
|
||||
When I go to the end of the word "abc"
|
||||
And I press "M-f"
|
||||
And I press "M-$"
|
||||
And I type "hmm"
|
||||
Then I should see:
|
||||
"""
|
||||
(defun abc (hmm) (message hmm))
|
||||
(defun def (ghi) (message some-other-ghi))
|
||||
"""
|
||||
|
||||
Scenario: Mark all symbols by pressing twice
|
||||
Given I turn on emacs-lisp-mode
|
||||
And I turn on delete-selection-mode
|
||||
And I insert:
|
||||
"""
|
||||
(defun abc (ghi) (message ghi))
|
||||
(defun def (ghi) (message ghi))
|
||||
"""
|
||||
When I go to the end of the word "abc"
|
||||
And I press "M-f"
|
||||
And I press "M-$"
|
||||
And I press "M-$"
|
||||
And I type "hmm"
|
||||
Then I should see:
|
||||
"""
|
||||
(defun abc (hmm) (message hmm))
|
||||
(defun def (hmm) (message hmm))
|
||||
"""
|
||||
@@ -23,6 +23,7 @@
|
||||
(global-set-key (kbd "C->") 'mc/mark-next-like-this)
|
||||
(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-like-this-dwim)
|
||||
(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)
|
||||
|
||||
Reference in New Issue
Block a user