From 53c9a337fa3218cdb857bd9fb75f542413f9584b Mon Sep 17 00:00:00 2001 From: Toru TSUNEYOSHI Date: Fri, 30 Nov 2012 15:10:30 +0800 Subject: [PATCH] * textmodes/fill.el (fill-region-as-paragraph): Handle overshoot by move-to-column. Fixes: debbugs:3234 --- lisp/ChangeLog | 5 +++++ lisp/textmodes/fill.el | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e0b140bc276..eef59e75ac8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-11-30 Toru TSUNEYOSHI + + * textmodes/fill.el (fill-region-as-paragraph): Handle overshoot + by move-to-column (Bug#3234). + 2012-11-30 Chong Yidong * longlines.el (longlines-wrap-line, longlines-encode-region): diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index d0e90c99516..86a1736783d 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -721,7 +721,11 @@ space does not end a sentence, so don't break a line there." (move-to-column (current-fill-column)) (if (when (< (point) to) ;; Find the position where we'll break the line. - (forward-char 1) ;Use an immediately following space, if any. + ;; Use an immediately following space, if any. + ;; However, note that `move-to-column' may overshoot + ;; if there are wide characters (Bug#3234). + (unless (> (current-column) (current-fill-column)) + (forward-char 1)) (fill-move-to-break-point linebeg) ;; Check again to see if we got to the end of ;; the paragraph. -- 2.39.5