# HG changeset patch # User Kim F. Storm # Date 1094165782 0 # Node ID 77bbb90bd021c66a1718dd69efb2e59b5797892a # Parent b4c980745e7f93e768eb85982799bbd608d4e8ab (cua--rectangle-set-corners): Ensure that point is set (and displayed) inside rectangle. (cua--rectangle-operation): Fix for highlight of empty lines. (cua--highlight-rectangle): Fix highlight for tabs. Position cursor at left/right edge of rectangle using new `cursor' property on overlay strings. (cua--indent-rectangle): Don't tabify. (cua-rotate-rectangle): Ignore that point has moved. diff -r b4c980745e7f -r 77bbb90bd021 lisp/emulation/cua-rect.el --- a/lisp/emulation/cua-rect.el Thu Sep 02 22:55:59 2004 +0000 +++ b/lisp/emulation/cua-rect.el Thu Sep 02 22:56:22 2004 +0000 @@ -274,7 +274,11 @@ (move-to-column mc) (set-mark (point)) (goto-char pp) - (move-to-column pc) + (if (and (if (cua--rectangle-right-side) + (= (move-to-column pc) (- pc tab-width)) + (> (move-to-column pc) pc)) + (not (bolp))) + (backward-char 1)) )) ;;; Rectangle resizing @@ -569,6 +573,8 @@ (setq end (min (window-end) end))) (goto-char end) (setq end (line-end-position)) + (if (and visible (bolp) (not (eobp))) + (setq end (1+ end))) (goto-char start) (setq start (line-beginning-position)) (narrow-to-region start end) @@ -761,7 +767,7 @@ (cua--rectangle-operation nil t nil nil nil ; do not tabify '(lambda (s e l r v) (let ((rface (if v 'cua-rectangle-face 'cua-rectangle-noselect-face)) - overlay bs as) + overlay bs ms as) (if (= s e) (setq e (1+ e))) (when (cua--rectangle-virtual-edges) (let ((lb (line-beginning-position)) @@ -791,23 +797,31 @@ (setq s (1- s)))) (cond ((= cr r) - (if (and (/= cr0 (1- cr)) - (= (mod cr tab-width) 0)) + (if (and (/= pr le) + (/= cr0 (1- cr)) + (or bs (/= cr0 (- cr tab-width))) + (/= (mod cr tab-width) 0)) (setq e (1- e)))) ((= cr cl) - (setq bs (concat bs - (propertize - (make-string - (- r l) - (if cua--virtual-edges-debug ?, ?\s)) - 'face rface))) + (setq ms (propertize + (make-string + (- r l) + (if cua--virtual-edges-debug ?, ?\s)) + 'face rface)) + (if (cua--rectangle-right-side) + (put-text-property (1- (length ms)) (length ms) 'cursor t ms) + (put-text-property 0 1 'cursor t ms)) + (setq bs (concat bs ms)) (setq rface nil)) - (t + (t (setq as (propertize (make-string (- r cr0 (if (= le pr) 1 0)) (if cua--virtual-edges-debug ?~ ?\s)) 'face rface)) + (if (cua--rectangle-right-side) + (put-text-property (1- (length as)) (length as) 'cursor t as) + (put-text-property 0 1 'cursor t as)) (if (/= pr le) (setq e (1- e)))))))) ;; Trim old leading overlays. @@ -826,7 +840,7 @@ (move-overlay overlay s e) (setq old (cdr old))) (setq overlay (make-overlay s e))) - (overlay-put overlay 'before-string bs) + (overlay-put overlay 'before-string bs) (overlay-put overlay 'after-string as) (overlay-put overlay 'face rface) (setq new (cons overlay new)))))) @@ -839,7 +853,7 @@ (let ((col (cua--rectangle-insert-col)) (pad (cua--rectangle-virtual-edges)) indent) - (cua--rectangle-operation (if clear 'clear 'corners) nil t pad t + (cua--rectangle-operation (if clear 'clear 'corners) nil t pad nil '(lambda (s e l r) (move-to-column col pad) (if (and (eolp) @@ -975,7 +989,9 @@ (defun cua-rotate-rectangle () (interactive) (cua--rectangle-corner (if (= (cua--rectangle-left) (cua--rectangle-right)) 0 1)) - (cua--rectangle-set-corners)) + (cua--rectangle-set-corners) + (if (cua--rectangle-virtual-edges) + (setq cua--buffer-and-point-before-command nil))) (defun cua-toggle-rectangle-virtual-edges () (interactive)