mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Added testcase for mc-hide-unmatched-lines-mode
This commit is contained in:
parent
653d52352d
commit
bf9e8e95e0
73
features/hide-unmatched-lines.feature
Normal file
73
features/hide-unmatched-lines.feature
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
Feature: Hiding lines without cursor
|
||||||
|
|
||||||
|
Scenario: Hiding lines when three cursor active
|
||||||
|
Given I have cursors at "line" in :
|
||||||
|
"""
|
||||||
|
0
|
||||||
|
line
|
||||||
|
2
|
||||||
|
3
|
||||||
|
line
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
11
|
||||||
|
line
|
||||||
|
13
|
||||||
|
14
|
||||||
|
15
|
||||||
|
"""
|
||||||
|
And I press "C-'"
|
||||||
|
Then I should have 3 cursors
|
||||||
|
Then I should see exactly:
|
||||||
|
"""
|
||||||
|
0
|
||||||
|
line
|
||||||
|
2
|
||||||
|
3
|
||||||
|
line
|
||||||
|
5
|
||||||
|
6
|
||||||
|
|
||||||
|
10
|
||||||
|
11
|
||||||
|
line
|
||||||
|
13
|
||||||
|
14
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Hiding lines when only two cursor active
|
||||||
|
When I insert:
|
||||||
|
"""
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
text
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
"""
|
||||||
|
And I go to the front of the word "text"
|
||||||
|
And I press "C->"
|
||||||
|
And I press "C-'"
|
||||||
|
Then I should have 2 cursors
|
||||||
|
Then I should see exactly:
|
||||||
|
"""
|
||||||
|
|
||||||
|
4
|
||||||
|
5
|
||||||
|
text
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
|
||||||
|
"""
|
@ -79,6 +79,17 @@
|
|||||||
(mc/mark-all-like-this)
|
(mc/mark-all-like-this)
|
||||||
(mc/keyboard-quit)))
|
(mc/keyboard-quit)))
|
||||||
|
|
||||||
|
(Given "^I have cursors at \"\\(.+\\)\" in \\(?: \"\\(.+\\)\"\\|:\\)$"
|
||||||
|
(lambda (needle haystack)
|
||||||
|
(insert haystack)
|
||||||
|
(goto-char (point-min))
|
||||||
|
(search-forward needle)
|
||||||
|
(set-mark (point))
|
||||||
|
(goto-char (match-beginning 0))
|
||||||
|
(mc/mark-all-like-this)
|
||||||
|
(mc/keyboard-quit)))
|
||||||
|
|
||||||
|
|
||||||
(When "^I copy \"\\(.+\\)\" in another program$"
|
(When "^I copy \"\\(.+\\)\" in another program$"
|
||||||
(lambda (text)
|
(lambda (text)
|
||||||
(lexical-let ((text text))
|
(lexical-let ((text text))
|
||||||
@ -137,3 +148,19 @@
|
|||||||
(split-string rest))
|
(split-string rest))
|
||||||
"-"))))
|
"-"))))
|
||||||
(call-interactively func))))
|
(call-interactively func))))
|
||||||
|
|
||||||
|
(Then "^I should see exactly\\(?: \"\\(.+\\)\"\\|:\\)$"
|
||||||
|
"Asserts that the current buffer does not include some text with
|
||||||
|
respect of text hidden by overlays"
|
||||||
|
(lambda (expected)
|
||||||
|
(let ((p (point-min))
|
||||||
|
(visible-text "")
|
||||||
|
(message "Expected '%s' to be part of '%s', but was not found in current buffer.")
|
||||||
|
)
|
||||||
|
(while (not (= p (point-max)))
|
||||||
|
(if (not (invisible-p p))
|
||||||
|
(setq visible-text (concat visible-text (buffer-substring p (1+ p))))
|
||||||
|
)
|
||||||
|
(setq p (1+ p))
|
||||||
|
)
|
||||||
|
(cl-assert (s-equals? expected visible-text) nil message expected visible-text))))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user