diff options
| -rw-r--r-- | lisp/rect.el | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lisp/rect.el b/lisp/rect.el index 0212dedcb48..93007824679 100644 --- a/lisp/rect.el +++ b/lisp/rect.el | |||
| @@ -766,7 +766,17 @@ Ignores `line-move-visual'." | |||
| 766 | ((not rectangle-mark-mode) | 766 | ((not rectangle-mark-mode) |
| 767 | (funcall orig)) | 767 | (funcall orig)) |
| 768 | (t | 768 | (t |
| 769 | (apply #'min (mapcar #'car (region-bounds)))))) | 769 | (save-excursion |
| 770 | (let* ((pt (point)) | ||
| 771 | (mk (mark)) | ||
| 772 | (start (min pt mk)) | ||
| 773 | (end (max pt mk)) | ||
| 774 | (cols (rectangle--pos-cols start end)) | ||
| 775 | (startcol (car cols)) | ||
| 776 | (endcol (cdr cols))) | ||
| 777 | (goto-char start) | ||
| 778 | (move-to-column (min startcol endcol)) | ||
| 779 | (point)))))) | ||
| 770 | 780 | ||
| 771 | (defun rectangle--region-end (orig) | 781 | (defun rectangle--region-end (orig) |
| 772 | "Like `region-end' but supports rectangular regions." | 782 | "Like `region-end' but supports rectangular regions." |
| @@ -774,7 +784,17 @@ Ignores `line-move-visual'." | |||
| 774 | ((not rectangle-mark-mode) | 784 | ((not rectangle-mark-mode) |
| 775 | (funcall orig)) | 785 | (funcall orig)) |
| 776 | (t | 786 | (t |
| 777 | (apply #'max (mapcar #'cdr (region-bounds)))))) | 787 | (save-excursion |
| 788 | (let* ((pt (point)) | ||
| 789 | (mk (mark)) | ||
| 790 | (start (min pt mk)) | ||
| 791 | (end (max pt mk)) | ||
| 792 | (cols (rectangle--pos-cols start end)) | ||
| 793 | (startcol (car cols)) | ||
| 794 | (endcol (cdr cols))) | ||
| 795 | (goto-char end) | ||
| 796 | (move-to-column (max startcol endcol)) | ||
| 797 | (point)))))) | ||
| 778 | 798 | ||
| 779 | (defun rectangle--extract-region (orig &optional delete) | 799 | (defun rectangle--extract-region (orig &optional delete) |
| 780 | (cond | 800 | (cond |