changeset 56902:8d62e1b62c44

* 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.
author Kim F. Storm <storm@cua.dk>
date Fri, 03 Sep 2004 12:33:54 +0000
parents 8090066a536d
children e4b0dc013442
files lisp/emulation/cua-rect.el
diffstat 1 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/cua-rect.el	Fri Sep 03 12:19:45 2004 +0000
+++ b/lisp/emulation/cua-rect.el	Fri Sep 03 12:33:54 2004 +0000
@@ -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 @@
     (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 @@
 
 (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 @@
  	     (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)