(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
(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)
(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))
(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.
(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))))))
(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)
(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)