* textmodes/fill.el (fill-region-as-paragraph): Handle overshoot by move-to-column.
authorToru TSUNEYOSHI <t_tuneyosi@hotmail.com>
Fri, 30 Nov 2012 07:10:30 +0000 (15:10 +0800)
committerChong Yidong <cyd@gnu.org>
Fri, 30 Nov 2012 07:10:30 +0000 (15:10 +0800)
Fixes: debbugs:3234

lisp/ChangeLog
lisp/textmodes/fill.el

index e0b140b..eef59e7 100644 (file)
@@ -1,3 +1,8 @@
+2012-11-30  Toru TSUNEYOSHI  <t_tuneyosi@hotmail.com>
+
+       * textmodes/fill.el (fill-region-as-paragraph): Handle overshoot
+       by move-to-column (Bug#3234).
+
 2012-11-30  Chong Yidong  <cyd@gnu.org>
 
        * longlines.el (longlines-wrap-line, longlines-encode-region):
index d0e90c9..86a1736 100644 (file)
@@ -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.