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

From: Eli Zaretskii <[email-masked]>
Date: Sun, 24 Aug 2025 07:45:08 +0300

> Date: Sat, 23 Aug 2025 22:18:33 +0200
> From: Marco <[email-masked]>
> 
> Description:
> 
> Hi, when using `display-line-numbers-mode` with relative numbering, 
> scrolling a buffer sometimes produces
> colored horizontal lines or dots in the line-number margin.
> 
> Steps to reproduce:
> 1. Start Emacs with GTK.
> 2. Enable relative line numbers:
>     (setq display-line-numbers-type 'relative)
>     (global-display-line-numbers-mode 1)
> 3. Scroll the buffer up and down.
> 
> Observed behavior:
> - Horizontal bars or dots appear in the line-number margin while scrolling.
> - Artifacts are colored (green/magenta/white on monitor) but screenshots 
> show them as dark blue.
> - Absolute line numbers render correctly without artifacts.
> 
> Environment:
> - Emacs version: GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, GTK+ 
> Version 3.24.41, cairo version 1.18.0) of 2025-08-15
> 
> - GTK version: 3.24.41
> 
> - OS: Ubuntu 24.04 with Gnome and Wayland
> 
> - Theme: Dracula
> 
> Additional observations:
> - The issue persists with GDK_DEBUG=nogl and GDK_BACKEND=x11.
> - Forcing a solid background for 'line-number' and 
> 'line-number-current-line' mitigates the issue:
>    (set-face-attribute 'line-number nil :background "#282a36" 
> :foreground "#6272a4")
>    (set-face-attribute 'line-number-current-line nil :background 
> "#282a36" :foreground "#f8f8f2")
> - Increasing display-line-numbers-width does not affect the artifacts.
> 
> Expected behavior:
> Line-number margin should update cleanly without leaving visual artifacts.
> 
> This appears to be related specifically to the redraw path of relative 
> line numbers in `display-line-numbers-mode`.

I cannot reproduce this, but I don't have access to a GTK build.

It is possible that the problem is due to some "display optimization"
features in your video display driver software, so if you can try
disabling any such features, please do, and then try again.

Failing that, perhaps someone else who has access to such a build will
be able to reproduce and debug this.