Subject: bug#79295: [Bug] Artifacts in margin with display-line-numbers-mode (relative)

From: Eli Zaretskii <[email-masked]>
Date: Sun, 24 Aug 2025 22:18:10 +0300

[Please use Reply All to reply, to keep the bug tracker on the CC list.]

> Date: Sun, 24 Aug 2025 21:07:05 +0200
> From: Marco <[email-masked]>
> 
> Hi,
> 
> thanks for looking into it. I made some more tests today.
> 
> Findings:
> 
> The issue occurs only in a Wayland session.
> 
> When running Emacs in a true X11 session, the problem does not appear at 
> all. If I'm wrong I'll correct myself.
> 
> Setting GDK_BACKEND=x11 while under Wayland does not eliminate the 
> problem, which suggests it still goes through XWayland and the 
> compositor path.
> 
> The artifacts are visible in screenshots and occur sometimes across the 
> whole display width, though their colors sometimes differ slightly, 
> which suggests this is a rendering bug.
> 
> Most of the time they look similar to what you see here: 
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2012-05/msg00023.html 
> or 
> https://lists.gnu.org/archive/html/bug-gnu-emacs/2018-01/png1wmnm51YOW.png
> 
> It only seem to occur when the emacs window is maximized!
> 
> With absolute line numbers, I cannot reproduce the problem — it only 
> appears with relative line numbers.
> 
> Conclusion:
> This looks like a rendering bug in the GTK/Wayland (or XWayland) stack, 
> but Emacs may be triggering it in a specific way when drawing relative 
> line numbers.
> 
> This is maybe related: When opening emacs in nw mode and using relative 
> line number I also see artifacts, i.e.  lines across the whole window 
> width in a color slightly darker than the background. The height of the 
> line is the same like the block cursor height.
> 
> Again: This does not happen in a real x11 session.

Thanks for the footwork.

Po Lu, any ideas?  Are problems like this with Wayland known to exist?