bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17758: 24.3; The line isn't wrapped during printing if it contains n


From: Lars Ingebrigtsen
Subject: bug#17758: 24.3; The line isn't wrapped during printing if it contains non ascii chars
Date: Sat, 29 May 2021 07:38:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Tobias Bora <tobias.bora@gmail.com> writes:

> I saw a bug (and I'm not the only one to notice it) with printing a
> document with emacs. Indeed when there is a non ascii char in a line
> (for example 'e') the line isn't wrapped in the output .ps file.

(I'm going through old bug reports that unfortunately got little response at
the time.)

This is due to this code:

(defun ps-mule-plot-string (from to &optional _bg-color)
[...]
         (ascii-or-latin-1 "[\000-\377]+")
[...]
            ((looking-at ascii-or-latin-1)
             (let ((nchars (- (min (match-end 0) stop) (point))))
               (setq width (* average-width nchars))
               (if (< ps-width-remaining (+ run-width width))
                   (setq nchars (truncate (- ps-width-remaining run-width)
                                          average-width)
                         run-width (+ run-width (* nchars average-width))
                         endpos (+ (point) nchars))
                 (setq run-width (+ run-width width))
                 (forward-char nchars))))

            (t
             (while (and (< (point) stop) (not endpos))
               (setq width (char-width (following-char)))
               (if (< ps-width-remaining (+ run-width width))
                   (setq endpos (point))
                 (setq run-width (+ run-width width))
                 (forward-char 1))))))

This is trying to do word line wrapping if we're looking at ASCII or
Latin-1 text.  (I'm not sure I understand the reasoning behind that, but
perhaps it's because we don't want to wrap (say) Chinese text?  But...
what's so special about Latin-1?  Why not fold Cyrillic?)

Anyway, the regexp is buggy, why is why this doesn't work.  I've now
fixed this in Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

[Prev in Thread] Current Thread [Next in Thread]