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

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

bug#54406: 28.0.91; rcirc text wrapping


From: Ken Raeburn
Subject: bug#54406: 28.0.91; rcirc text wrapping
Date: Tue, 15 Mar 2022 18:24:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux)

Aha, debugging printfs to the rescue. :-)

I made a little tweak to rcirc-print, and added some logging advice to
rcirc-markup-fill and rcirc-fill-paragraph, then just sat back and
waited for some #emacs traffic; this is the one that triggered:

            (save-restriction
              (narrow-to-region (point) (point))
              (insert (propertize (rcirc-format-response-string process sender 
response
                                                              nil text)
                                'rcirc-msgid (rcirc-get-tag "msgid"))
                      (propertize "\n" 'hard t))

              ;; squeeze spaces out of text before rcirc-text
              ;; ADDED MESSAGE CALL:
              (message "rcirc-print(process=%S sender=%S response=%S target=%S 
text=%S activity=%S)\n\tfilling region: buffer=%S region=%S flag=%S"
                       process sender response target text activity
                       (current-buffer)
                       (buffer-substring (point-min) (point-max))
                       rcirc-fill-flag)
              (fill-region (point-min) (point-max))

rcirc-print(process=#<process irc.libera.chat> sender=#("userxy" 0 6 
(font-lock-face (rcirc-other-nick))) response="PRIVMSG" target="#emacs" text="a 
bunch of text here" activity=t)
        filling region: buffer=#<buffer #emacs@irc.libera.chat> 
region=#("<userxy> a bunch of text here
" 0 1 (rcirc-msgid nil) 1 7 (font-lock-face (rcirc-other-nick) rcirc-msgid nil) 
7 9 (rcirc-msgid nil) 9 96 (rcirc-text "a bunch of text here" rcirc-msgid nil) 
96 97 (hard t)) flag=nil

(For privacy, I’ve replaced the sender name with a same-length dummy,
and replaced the message text, though mine is shorter so the text
properties probably don’t work out.)

The old version in 27.1 did:

            ;; squeeze spaces out of text before rcirc-text
            (fill-region fill-start
                         (1- (or (next-single-property-change fill-start
                                                              'rcirc-text)
                                 rcirc-prompt-end-marker)))

where fill-start is set to

  (marker-position rcirc-prompt-start-marker)

evaluated before inserting the new text.  The new version seems to be
filling the entire narrowed region containing the just-inserted text.

As an experiment, I’m trying

              (fill-region (point-min)
                           (1- (or (next-single-property-change (point-min)
                                                                'rcirc-text)
                                   (point-max))))

and it seems to do what I want so far, both for NAMES messages and user
messages.

The property change is also looked up by the goto-char immediately
following the fill-region, so perhaps they could be reversed and the new
position used as a boundary.

Though, it seems to be filling the part of the rcirc-response-formats
formatted string that comes before the message text, and it’s not clear
to me that unconditionally filling that is the right thing, if
rcirc-fill-flag is nil. *shrug* I’m not a terribly experienced IRC user,
maybe it is generally desired.

Ken

P.S. The indentation of the “when” blocks following the goto-char could
use cleaning up.






reply via email to

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