djcb / mu

maildir indexer/searcher + emacs mail client + guile bindings
http://www.djcbsoftware.nl/code/mu
GNU General Public License v3.0
1.62k stars 391 forks source link

[mu4e bug] headers view display error on mark message #2782

Closed kpzart closed 2 weeks ago

kpzart commented 2 weeks ago

Describe the bug

In some cases, when I mark a message in headers view, the line completely disappears, messages below moving up one line. Found out, that this is only the case, when the mark text is longer than the message line.

How to Reproduce

Set your mu4e-headers-fields to something short e.g. ((:flags . 6)). Go to headers view and put e.g. delete mark on first message.

Fix

I could fix it with this:

diff --git a/mu4e/mu4e-mark.el b/mu4e/mu4e-mark.el
index 39103bad..77755764 100644
--- a/mu4e/mu4e-mark.el
+++ b/mu4e/mu4e-mark.el
@@ -281,7 +281,7 @@ The following marks are available, and the corresponding props:
                    ;; the docid cookie and then we skip the mu4e--mark-fringe
                    (start (+ (length mu4e--mark-fringe)
                              (mu4e~headers-goto-docid docid t)))
-                   (overlay (make-overlay start (+ start (length targetstr)))))
+                   (overlay (make-overlay start (min (line-end-position) (+ start (length targetstr))))))
               (overlay-put overlay 'display targetstr)
               (overlay-put overlay 'mu4e-mark t)
               (overlay-put overlay 'evaporate t)

Explanation: When the overlay is longer than the current line, the newline character is replaced by the overlay.

Environment

I am on Emacs 29.4 with spacemacs and mu 1.12.6. I checked the current master and the erroneous line still exists.

djcb commented 2 weeks ago

Yes, can reproduce. I'll include your change, thanks.