alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
475 stars 44 forks source link

Blank lines not displayed in message reply #252

Open progfolio opened 5 months ago

progfolio commented 5 months ago

OS/platform

Arch Linux

Emacs version and provenance

GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.39, cairo version 1.18.0) of 2024-01-04

Emacs command

emacs

Emacs frame type

GUI

Ement package version and provenance

version: c8fa944 0.14-pre installed via Elpaca

Actions taken

ement-reply-formatting-bug

  1. Send a message with blank lines. It is displayed properly.
  2. Reply to the first message. The reply has blank lines in it. They are not displayed in the reply. The formatting of the original message is altered as well.
  3. Note that when editing the message, the lines are preserved.

Android Element display for comparison:

image

Observed results

The reply should be formatted as I wrote it.

Expected results

The reply's formatting elides newlines.

Backtrace

No response

Etc.

No response

alphapapa commented 5 months ago

Likely caused by using shr to render the reply inside an HTML blockquote tag. Maybe we need to duplicate newlines, or replace them with br tags. What do you think?

progfolio commented 5 months ago

Replacing newlines with "\
" gets us part of the way there in ement-room--render-html:

-  (insert string))
+ (insert (replace-regexp-in-string "\n" "<br>" string))

But that will also replace newlines in a reply's already formatted HTML, so it doesn't seem like the right solution to me. Haven't had much time to dig into the source, but is there a way to separate the quoted portion of a reply from the body of the actual reply?

alphapapa commented 5 months ago

Haven't had much time to dig into the source, but is there a way to separate the quoted portion of a reply from the body of the actual reply?

Yes, but that is more easily handled by #150, which I want to merge soon, but haven't had time to test. If anyone wants to test that and provide feedback, it would help.