mirror of
https://github.com/magnars/multiple-cursors.el.git
synced 2025-10-13 13:03:03 +00:00
Tests for rectangular-region-mode
This commit is contained in:
parent
c3c454441b
commit
ca0e0ae9d9
73
features/rectangular-region.feature
Normal file
73
features/rectangular-region.feature
Normal file
@ -0,0 +1,73 @@
|
||||
Feature: Rectangular region
|
||||
|
||||
Scenario: Works like regular region when on one line
|
||||
When I insert "some text"
|
||||
And I press "H-SPC"
|
||||
And I press "M-b"
|
||||
Then the region should be "text"
|
||||
And rectangular-region-mode should be on
|
||||
|
||||
Scenario: Works like regular region when on one line, insert
|
||||
Given I turn on delete-selection-mode
|
||||
When I insert "some text"
|
||||
And I press "H-SPC"
|
||||
And I press "M-b"
|
||||
And I type "replacement"
|
||||
Then I should see "some replacement"
|
||||
And rectangular-region-mode should be off
|
||||
|
||||
Scenario: Works like regular region when on one line, copy 1
|
||||
Given I turn on delete-selection-mode
|
||||
When I insert "some text"
|
||||
And I press "H-SPC"
|
||||
And I press "M-b"
|
||||
And I press "M-w"
|
||||
Then rectangular-region-mode should be off
|
||||
|
||||
Scenario: Works like regular region when on one line, copy 2
|
||||
Given I turn on delete-selection-mode
|
||||
When I insert "some text"
|
||||
And I press "H-SPC"
|
||||
And I press "M-b"
|
||||
And I press "M-w"
|
||||
And I press "C-y"
|
||||
Then I should see "some texttext"
|
||||
|
||||
Scenario: Changing multiple lines
|
||||
Given I turn on delete-selection-mode
|
||||
When I insert:
|
||||
"""
|
||||
This is some text
|
||||
This is more text
|
||||
"""
|
||||
And I go to point "6"
|
||||
And I press "H-SPC"
|
||||
And I press "M-f"
|
||||
And I press "C-n"
|
||||
And I type "was"
|
||||
Then I should see:
|
||||
"""
|
||||
This was some text
|
||||
This was more text
|
||||
"""
|
||||
And I should have 2 cursors
|
||||
|
||||
Scenario: Changing multiple lines with gaps
|
||||
Given I turn on delete-selection-mode
|
||||
When I insert:
|
||||
"""
|
||||
This is some text
|
||||
|
||||
This is more text
|
||||
"""
|
||||
And I go to point "6"
|
||||
And I press "H-SPC"
|
||||
And I go to the end of the word "more"
|
||||
And I type "was"
|
||||
Then I should see:
|
||||
"""
|
||||
This was text
|
||||
|
||||
This was text
|
||||
"""
|
||||
And I should have 2 cursors
|
@ -15,6 +15,16 @@
|
||||
(assert (eq 1 (mc/num-cursors)) nil
|
||||
"Expected to have one cursor, but there are still fake cursor overlays.")))
|
||||
|
||||
(Then "^rectangular-region-mode should be off$"
|
||||
(lambda ()
|
||||
(assert (not rectangular-region-mode) nil
|
||||
"Expected rectangular-region-mode mode to be off, but wasn't.")))
|
||||
|
||||
(Then "^rectangular-region-mode should be on$"
|
||||
(lambda ()
|
||||
(assert (rectangular-region-mode) nil
|
||||
"Expected rectangular-region-mode mode to be on, but wasn't.")))
|
||||
|
||||
(When "^I press \"\\(.+\\)\"$"
|
||||
(lambda (keybinding)
|
||||
(let ((macro (edmacro-parse-keys keybinding)))
|
||||
@ -57,3 +67,18 @@
|
||||
(lexical-let ((ins ins))
|
||||
(defun mc-test-temp-command-2 () (interactive) (insert ins))
|
||||
(global-set-key (kbd "C-!") 'mc-test-temp-command-2))))
|
||||
|
||||
(When "^I go to character \"\\(.+\\)\"$"
|
||||
(lambda (char)
|
||||
(goto-char (point-min))
|
||||
(let ((search (re-search-forward (format "%s" char) nil t))
|
||||
(message "Can not go to character '%s' since it does not exist in the current buffer: %s"))
|
||||
(assert search nil message char (espuds-buffer-contents)))))
|
||||
|
||||
(When "^I go to the \\(front\\|end\\) of the word \"\\(.+\\)\"$"
|
||||
(lambda (pos word)
|
||||
(goto-char (point-min))
|
||||
(let ((search (re-search-forward (format "%s" word) nil t))
|
||||
(message "Can not go to character '%s' since it does not exist in the current buffer: %s"))
|
||||
(assert search nil message word (espuds-buffer-contents))
|
||||
(if (string-equal "front" pos) (backward-word)))))
|
||||
|
@ -17,8 +17,10 @@
|
||||
|
||||
(Before
|
||||
(multiple-cursors-mode 0)
|
||||
(rectangular-region-mode 0)
|
||||
(mm/clear-all)
|
||||
(global-set-key (kbd "C->") 'mark-next-like-this)
|
||||
(global-set-key (kbd "H-SPC") 'set-rectangular-region-anchor)
|
||||
(switch-to-buffer
|
||||
(get-buffer-create "*multiple-cursors*"))
|
||||
(erase-buffer)
|
||||
|
@ -61,6 +61,10 @@
|
||||
(when rectangular-region-mode
|
||||
(rrm/switch-to-multiple-cursors)))
|
||||
|
||||
(defadvice kill-ring-save (before switch-from-rrm-to-mc activate)
|
||||
(when rectangular-region-mode
|
||||
(rrm/switch-to-multiple-cursors)))
|
||||
|
||||
(define-minor-mode rectangular-region-mode
|
||||
"A mode for creating a rectangular region to edit"
|
||||
nil " rr" rectangular-region-mode-map
|
||||
|
@ -7,13 +7,13 @@ end
|
||||
|
||||
def run_all_tests
|
||||
system('clear')
|
||||
result = run "./util/ecukes/ecukes"
|
||||
result = run "./util/ecukes/ecukes --graphical"
|
||||
puts result
|
||||
end
|
||||
|
||||
def run_test(file)
|
||||
system('clear')
|
||||
result = run "./util/ecukes/ecukes #{file}"
|
||||
result = run "./util/ecukes/ecukes --graphical #{file}"
|
||||
puts result
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user