From 67d6579eab87c5f3d7248ab8389186057fad38dc Mon Sep 17 00:00:00 2001 From: Andrea Orru Date: Sun, 17 Jul 2016 15:12:47 +0200 Subject: [PATCH] Updated tests, README. --- README.md | 2 ++ features/mark-more.feature | 16 ++++++++++++++++ .../step-definitions/multiple-cursors-steps.el | 12 ++++++++++++ features/support/env.el | 2 ++ 4 files changed, 32 insertions(+) diff --git a/README.md b/README.md index 10e7e4d..83a413f 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,8 @@ You can [watch an intro to multiple-cursors at Emacs Rocks](http://emacsrocks.co - `mc/mark-next-word-like-this`: Like `mc/mark-next-like-this` but only for whole words. - `mc/mark-next-symbol-like-this`: Like `mc/mark-next-like-this` but only for whole symbols. - `mc/mark-previous-like-this`: Adds a cursor and region at the next part of the buffer backwards that matches the current region. + - `mc/mark-previous-like-this-word`: Adds a cursor and region at the next part of the buffer backwards that matches the current region, if no region is selected it selects the word at the point. + - `mc/mark-previous-like-this-symbol`: Adds a cursor and region at the next part of the buffer backwards that matches the current region, if no region is selected it selects the symbol at the point. - `mc/mark-previous-word-like-this`: Like `mc/mark-previous-like-this` but only for whole words. - `mc/mark-previous-symbol-like-this`: Like `mc/mark-previous-like-this` but only for whole symbols. - `mc/mark-more-like-this-extended`: Use arrow keys to quickly mark/skip next/previous occurances. diff --git a/features/mark-more.feature b/features/mark-more.feature index d8d1025..f057678 100644 --- a/features/mark-more.feature +++ b/features/mark-more.feature @@ -14,6 +14,14 @@ Feature: Marking multiple parts of the buffer And I type "sentence" Then I should see "This sentence has the word sentence in it" + Scenario: Marking next like this, word + Given I turn on delete-selection-mode + When I insert "This text has the word text in it" + And I go to word "text" + And I press "C-S-c C->" + And I type "sentence" + Then I should see "This sentence has the word sentence in it" + Scenario: Skipping a mark Given I turn on delete-selection-mode When I insert "Here's text, text and text" @@ -54,6 +62,14 @@ Feature: Marking multiple parts of the buffer And I type "sentence" Then I should see "This sentence has the word sentence in it" + Scenario: Marking prev like this, word + Given I turn on delete-selection-mode + When I insert "This text has the word text in it" + And I go to last word "text" + And I press "C-S-c C-<" + And I type "sentence" + Then I should see "This sentence has the word sentence in it" + Scenario: Skipping a prev mark Given I turn on delete-selection-mode When I insert "Here's text, text and text" diff --git a/features/step-definitions/multiple-cursors-steps.el b/features/step-definitions/multiple-cursors-steps.el index b57bd03..2eb442e 100644 --- a/features/step-definitions/multiple-cursors-steps.el +++ b/features/step-definitions/multiple-cursors-steps.el @@ -12,6 +12,12 @@ (When "^I mark previous like this$" (lambda () (call-interactively 'mc/mark-previous-like-this))) +(When "^I mark previous like this word$" + (lambda () (call-interactively 'mc/mark-previous-like-this-word))) + +(When "^I mark previous like this symbol$" + (lambda () (call-interactively 'mc/mark-previous-like-this-symbol))) + (When "^I mark all like this$" (lambda () (call-interactively 'mc/mark-all-like-this))) @@ -144,6 +150,12 @@ (cl-assert search nil message word (espuds-buffer-contents)) (if (string-equal "front" pos) (backward-word))))) +(When "^I go to last word \"\\(.+\\)\"$" + (lambda (text) + (goto-char (point-max)) + (let ((search (re-search-backward text nil t))) + (cl-assert search nil "The text '%s' was not found in the current buffer." text)))) + (When "^I select the last \"\\(.+\\)\"$" (lambda (text) (goto-char (point-max)) diff --git a/features/support/env.el b/features/support/env.el index 225c429..8410ca3 100644 --- a/features/support/env.el +++ b/features/support/env.el @@ -24,6 +24,8 @@ (global-set-key (kbd "C-S-c C->") 'mc/mark-next-like-this-word) (global-set-key (kbd "C-S-c M->") 'mc/mark-next-like-this-symbol) (global-set-key (kbd "C-<") 'mc/mark-previous-like-this) + (global-set-key (kbd "C-S-c C-<") 'mc/mark-previous-like-this-word) + (global-set-key (kbd "C-S-c M-<") 'mc/mark-previous-like-this-symbol) (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 "C-$") 'mc/mark-all-dwim)