[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: |
Eli Zaretskii |
Subject: |
bug#17758: 24.3; The line isn't wrapped during printing if it contains non ascii chars |
Date: |
Sat, 29 May 2021 09:38:37 +0300 |
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Sat, 29 May 2021 07:38:15 +0200
> Cc: 17758@debbugs.gnu.org
>
> (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.
I'm not sure I understand the fix, can you explain it?
Regarding the reason for limiting ourselves to Latin-1: AFAIR, ps-mule
doesn't support non-ASCII characters outside Latin-1 and CJK character
sets. Perhaps this is the reason for this code? But the only expert
on this is Handa-san (CC'ed): perhaps he could help us understand what
the code is doing?