Permalink
Browse files

C-g moves back to start of expansions also in cua-mode.

Fixes #32
  • Loading branch information...
1 parent 8e964a7 commit 61be6ea481981b8fc87ce74850d20ba23e938f7d @magnars committed Apr 14, 2012
Showing with 16 additions and 0 deletions.
  1. +4 −0 expand-region-core.el
  2. +11 −0 features/expand-region.feature
  3. +1 −0 features/support/env.el
View
@@ -379,6 +379,10 @@ before calling `er/expand-region' for the first time."
(when (memq last-command '(er/expand-region er/contract-region))
(er/contract-region 0)))
+(defadvice cua-cancel (before collapse-region activate)
+ (when (memq last-command '(er/expand-region er/contract-region))
+ (er/contract-region 0)))
+
(defun er/clear-history (&rest args)
"Clear the history."
(setq er/history '())
@@ -144,6 +144,17 @@ Feature: Expand Region
Then the region should not be active
And cursor should be at point "6"
+ Scenario: C-g to move back to start of expansions also with cua-mode
+ Given there is no region selected
+ When I turn on cua-mode
+ And I insert "(((45678)))"
+ And I go to point "6"
+ And I press "C-@"
+ And I press "C-@"
+ And I press "C-g"
+ Then the region should not be active
+ And cursor should be at point "6"
+
Scenario: Pop mark twice to get back to start of expansions
Given there is no region selected
When I insert "(((45678)))"
View
@@ -18,6 +18,7 @@
(get-buffer-create "*expand-region*"))
(erase-buffer)
(transient-mark-mode 1)
+ (cua-mode 0)
(setq set-mark-default-inactive nil)
(deactivate-mark))

0 comments on commit 61be6ea

Please sign in to comment.