diff options
author | Kim F. Storm <storm@cua.dk> | 2004-09-02 22:56:22 +0000 |
---|---|---|
committer | Kim F. Storm <storm@cua.dk> | 2004-09-02 22:56:22 +0000 |
commit | a85a088c18cf0b58386274da954cab4310fb59dc (patch) | |
tree | 92c0762498a35857a6744e1c2d8b9f31a98739b8 /lisp | |
parent | 46b3ce37762a32617ca2f33273c9b3af728b03e0 (diff) | |
download | emacs-a85a088c18cf0b58386274da954cab4310fb59dc.tar.gz |
(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.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emulation/cua-rect.el | 44 |
1 files changed, 30 insertions, 14 deletions
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index 626ef22cf2d..03bf28494c3 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el @@ -274,7 +274,11 @@ Knows about CUA rectangle highlighting in addition to standard undo." (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 @@ If command is repeated at same position, delete the rectangle." (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 @@ If command is repeated at same position, delete the rectangle." (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 @@ If command is repeated at same position, delete the rectangle." (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 @@ If command is repeated at same position, delete the rectangle." (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 @@ If command is repeated at same position, delete the rectangle." (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 @@ With prefix argument, the toggle restriction." (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) |