summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lisp/rect.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/lisp/rect.el b/lisp/rect.el
index d8e742ce6a1..2904f94687a 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -60,6 +60,10 @@ Point is at the end of the segment of this line within the rectangle."
(setq begextra (- (current-column) startcol))
(setq startpos (point))
(move-to-column endcol coerce-tabs)
+ ;; If we overshot, move back one character
+ ;; so that endextra will be positive.
+ (if (and (not coerce-tabs) (> (current-column) endcol))
+ (backward-char 1))
(setq endextra (- endcol (current-column)))
(if (< begextra 0)
(setq endextra (+ endextra begextra)