diff options
| author | Kim F. Storm | 2004-09-03 12:33:54 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2004-09-03 12:33:54 +0000 |
| commit | 1e71278bd3f67a41df44c56361f2b9c3b346d61b (patch) | |
| tree | 54d44e8da70281bfeefab1b62a6455ae1460ac7f /lisp | |
| parent | c59ee3b4c27bc4b77706fd3332317160f50dd913 (diff) | |
| download | emacs-1e71278bd3f67a41df44c56361f2b9c3b346d61b.tar.gz emacs-1e71278bd3f67a41df44c56361f2b9c3b346d61b.zip | |
* 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')
| -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 @@ | |||
| 65 | (defvar cua--rectangle-overlays nil) | 65 | (defvar cua--rectangle-overlays nil) |
| 66 | (make-variable-buffer-local 'cua--rectangle-overlays) | 66 | (make-variable-buffer-local 'cua--rectangle-overlays) |
| 67 | 67 | ||
| 68 | (defvar cua--overlay-keymap | ||
| 69 | (let ((map (make-sparse-keymap))) | ||
| 70 | (define-key map "\r" 'cua-rotate-rectangle))) | ||
| 71 | |||
| 68 | (defvar cua--virtual-edges-debug nil) | 72 | (defvar cua--virtual-edges-debug nil) |
| 69 | 73 | ||
| 70 | ;; Per-buffer CUA mode undo list. | 74 | ;; Per-buffer CUA mode undo list. |
| @@ -274,8 +278,10 @@ Knows about CUA rectangle highlighting in addition to standard undo." | |||
| 274 | (move-to-column mc) | 278 | (move-to-column mc) |
| 275 | (set-mark (point)) | 279 | (set-mark (point)) |
| 276 | (goto-char pp) | 280 | (goto-char pp) |
| 281 | ;; Move cursor inside rectangle, except if char at rigth edge is a tab. | ||
| 277 | (if (and (if (cua--rectangle-right-side) | 282 | (if (and (if (cua--rectangle-right-side) |
| 278 | (= (move-to-column pc) (- pc tab-width)) | 283 | (and (= (move-to-column pc) (- pc tab-width)) |
| 284 | (not (eolp))) | ||
| 279 | (> (move-to-column pc) pc)) | 285 | (> (move-to-column pc) pc)) |
| 280 | (not (bolp))) | 286 | (not (bolp))) |
| 281 | (backward-char 1)) | 287 | (backward-char 1)) |
| @@ -285,7 +291,11 @@ Knows about CUA rectangle highlighting in addition to standard undo." | |||
| 285 | 291 | ||
| 286 | (defun cua--forward-line (n) | 292 | (defun cua--forward-line (n) |
| 287 | ;; Move forward/backward one line. Returns t if movement. | 293 | ;; Move forward/backward one line. Returns t if movement. |
| 288 | (= (forward-line n) 0)) | 294 | (let ((pt (point))) |
| 295 | (and (= (forward-line n) 0) | ||
| 296 | ;; Deal with end of buffer | ||
| 297 | (or (not (eobp)) | ||
| 298 | (goto-char pt))))) | ||
| 289 | 299 | ||
| 290 | (defun cua--rectangle-resized () | 300 | (defun cua--rectangle-resized () |
| 291 | ;; Refresh state after resizing rectangle | 301 | ;; Refresh state after resizing rectangle |
| @@ -843,6 +853,7 @@ If command is repeated at same position, delete the rectangle." | |||
| 843 | (overlay-put overlay 'before-string bs) | 853 | (overlay-put overlay 'before-string bs) |
| 844 | (overlay-put overlay 'after-string as) | 854 | (overlay-put overlay 'after-string as) |
| 845 | (overlay-put overlay 'face rface) | 855 | (overlay-put overlay 'face rface) |
| 856 | (overlay-put overlay 'keymap cua--overlay-keymap) | ||
| 846 | (setq new (cons overlay new)))))) | 857 | (setq new (cons overlay new)))))) |
| 847 | ;; Trim old trailing overlays. | 858 | ;; Trim old trailing overlays. |
| 848 | (mapcar (function delete-overlay) old) | 859 | (mapcar (function delete-overlay) old) |