diff options
author | Kim F. Storm <storm@cua.dk> | 2004-09-03 12:33:54 +0000 |
---|---|---|
committer | Kim F. Storm <storm@cua.dk> | 2004-09-03 12:33:54 +0000 |
commit | 1e71278bd3f67a41df44c56361f2b9c3b346d61b (patch) | |
tree | 54d44e8da70281bfeefab1b62a6455ae1460ac7f /lisp/emulation/cua-rect.el | |
parent | c59ee3b4c27bc4b77706fd3332317160f50dd913 (diff) | |
download | emacs-1e71278bd3f67a41df44c56361f2b9c3b346d61b.tar.gz |
* emulation/cua-rect.el (cua--overlay-keymap): New keymap for
highlight overlays; allow using RET when cursor is over a button.
(cua--highlight-rectangle): Use it.
(cua--rectangle-set-corners): Don't move backwards at eol.
(cua--forward-line): Don't move into void after eob.
Diffstat (limited to 'lisp/emulation/cua-rect.el')
-rw-r--r-- | lisp/emulation/cua-rect.el | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index 03bf28494c3..3270b7fd62c 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el @@ -65,6 +65,10 @@ (defvar cua--rectangle-overlays nil) (make-variable-buffer-local 'cua--rectangle-overlays) +(defvar cua--overlay-keymap + (let ((map (make-sparse-keymap))) + (define-key map "\r" 'cua-rotate-rectangle))) + (defvar cua--virtual-edges-debug nil) ;; Per-buffer CUA mode undo list. @@ -274,8 +278,10 @@ Knows about CUA rectangle highlighting in addition to standard undo." (move-to-column mc) (set-mark (point)) (goto-char pp) + ;; Move cursor inside rectangle, except if char at rigth edge is a tab. (if (and (if (cua--rectangle-right-side) - (= (move-to-column pc) (- pc tab-width)) + (and (= (move-to-column pc) (- pc tab-width)) + (not (eolp))) (> (move-to-column pc) pc)) (not (bolp))) (backward-char 1)) @@ -285,7 +291,11 @@ Knows about CUA rectangle highlighting in addition to standard undo." (defun cua--forward-line (n) ;; Move forward/backward one line. Returns t if movement. - (= (forward-line n) 0)) + (let ((pt (point))) + (and (= (forward-line n) 0) + ;; Deal with end of buffer + (or (not (eobp)) + (goto-char pt))))) (defun cua--rectangle-resized () ;; Refresh state after resizing rectangle @@ -843,6 +853,7 @@ If command is repeated at same position, delete the rectangle." (overlay-put overlay 'before-string bs) (overlay-put overlay 'after-string as) (overlay-put overlay 'face rface) + (overlay-put overlay 'keymap cua--overlay-keymap) (setq new (cons overlay new)))))) ;; Trim old trailing overlays. (mapcar (function delete-overlay) old) |