multiple-cursors-steps.el (5367B)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | (When "^I mark next like this$" (lambda () (call-interactively 'mc/mark-next-like-this))) (When "^I mark previous like this$" (lambda () (call-interactively 'mc/mark-previous-like-this))) (When "^I mark all like this$" (lambda () (call-interactively 'mc/mark-all-like-this))) (When "^I mark all like this dwim$" (lambda () (call-interactively 'mc/mark-all-like-this-dwim))) (When "^I mark all in region$" (lambda () (call-interactively 'mc/mark-all-in-region))) (When "^I insert numbers$" (lambda () (call-interactively 'mc/insert-numbers))) (When "^I reverse regions$" (lambda () (call-interactively 'mc/reverse-regions))) (When "^I sort regions$" (lambda () (call-interactively 'mc/sort-regions))) (When "^I edit lines$" (lambda () (call-interactively 'mc/edit-lines))) (When "^I set rectangular region anchor$" (lambda () (call-interactively 'set-rectangular-region-anchor))) (And "^delete-selection-mode is active$" (lambda () (delete-selection-mode 1))) (Given "^I turn off transient-mark-mode$" (lambda () (transient-mark-mode -1))) (Then "^I should have \\([0-9]+\\) cursors$" (lambda (num) (let ((actual (mc/num-cursors))) (assert (eq (string-to-number num) actual) nil "Expected to have %s cursors, but was %d." num actual)))) (Then "^I should have one cursor$" (lambda () (assert (not multiple-cursors-mode) nil "Expected to have one cursor, but multiple-cursors-mode is still active.") (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))) (if espuds-chain-active (setq espuds-action-chain (vconcat espuds-action-chain macro)) (if (and (equal keybinding "C-g") (eq (key-binding (kbd "C-g")) 'keyboard-quit)) (espuds-quit) (execute-kbd-macro macro)))))) (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$" (lambda (text) (lexical-let ((text text)) (setq interprogram-paste-function #'(lambda () (let ((r text)) (setq text nil) r)))))) (Given "^I have bound C-! to a lambda that inserts \"\\(.+\\)\"$" (lambda (ins) (lexical-let ((ins ins)) (global-set-key (kbd "C-!") #'(lambda () (interactive) (insert ins)))))) (Given "^I have bound C-! to a new command that inserts \"\\(.+\\)\"$" (lambda (ins) (lexical-let ((ins ins)) (defun mc-test-temp-command () (interactive) (insert ins)) (global-set-key (kbd "C-!") 'mc-test-temp-command)))) (Given "^I have bound C-! to another new command that inserts \"\\(.+\\)\"$" (lambda (ins) (lexical-let ((ins ins)) (defun mc-test-temp-command-2 () (interactive) (insert ins)) (global-set-key (kbd "C-!") 'mc-test-temp-command-2)))) (Given "^I have bound C-! to a keyboard macro that insert \"_\"$" (lambda () (fset 'mc-test-temp-kmacro "\C-q_") (global-set-key (kbd "C-!") 'mc-test-temp-kmacro))) (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))))) (When "^I select the last \"\\(.+\\)\"$" (lambda (text) (goto-char (point-max)) (let ((search (re-search-backward text nil t))) (assert search nil "The text '%s' was not found in the current buffer." text)) (set-mark (point)) (re-search-forward text))) (When "^I mark all \\(.+\\)$" (lambda (rest) (let ((func (intern (mapconcat 'identity (cons "mc/mark-all" (split-string rest)) "-")))) (call-interactively func)))) |