From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 19 21:39:59 2025 Received: (at submit) by debbugs.gnu.org; 20 Aug 2025 01:39:59 +0000 Received: from localhost ([127.0.0.1]:55412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uoXnz-0001uF-Cn for submit@debbugs.gnu.org; Tue, 19 Aug 2025 21:39:59 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56982) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uoXnx-0001tw-69 for submit@debbugs.gnu.org; Tue, 19 Aug 2025 21:39:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uoXnr-0003nA-2y for bug-gnu-emacs@gnu.org; Tue, 19 Aug 2025 21:39:51 -0400 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uoXnp-0004Pq-D3 for bug-gnu-emacs@gnu.org; Tue, 19 Aug 2025 21:39:50 -0400 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-e94e40fd4f1so1655457276.2 for ; Tue, 19 Aug 2025 18:39:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755653987; x=1756258787; darn=gnu.org; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:from:to:cc:subject:date:message-id:reply-to; bh=As3HXKxS0mVeXq/LhJuhvOyAbVa5XgtUPAKEEb5kzj4=; b=fPF0zoiEpo7y33U+r8N3svg2iGMfnTJN8fPYl9P1xJW7EhdxUbe67aBe2u7S4JZdMD AM8nj/OSmzO8cxu7BVjh0kWkPbBoNWDzOK1W6w6kSidQTnNlYKCEG1oWpGoO2z318d2d 3Ir9riUsz4P03LXgEQdUEjL3Lm2LrFUgoUoDxIjn538oV40AgNbYMiSxUtBhyENZDOUg Fx8yyFNyOBhCgp3utgwguGD6We+umQIDWCzjJ0jBDUTqFKhJL5i8JzTz4szOk6HCUfyS t+MNhLULqBJBL+AgvO/gTRdRmSd41LdQqT/a4CDsxxzDQ+VmI9l7Kuitl5qDd9Ldshl8 KMGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755653987; x=1756258787; h=to:date:message-id:subject:mime-version:content-transfer-encoding :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=As3HXKxS0mVeXq/LhJuhvOyAbVa5XgtUPAKEEb5kzj4=; b=foa3X1A9gGzvePqF9KsF9cpx808kasrjKW/DNLzibNgQyDXbGWElzRkJwnaAAn3Y5J m1l9IpmYB/VmhAM7rH2QboTlcm0MpT5D9YLLlA4bmiFcudPczy9roOhhs0sMWcncIOUk m00w2p3EDKT1GLL6VHxLTgQwYewoWyHzl/8vnrA+Wv/tmZv9cjQYZXvcG4J91s7yzcax z3yp73W0Tn3IHs70dUMNykLZJJj5mSPIqMJmA0ouo5o3lFdREGwXKP5e32FiaGd/870Z v1O/kJbsu/BnXDTrb3KQKKk2a4r+bi1h3ZHvvN/ZjaYRfpjRQDMxl8ucOf6f7q2Jo8h3 7lQA== X-Gm-Message-State: AOJu0YynB0feQFnJtWyUKoclgoy8kGMxapcUEiBY9mOVEpy1jwm9IAG8 i2MMC4GYYD1xYcGFt9EPyZ6Yrt+amNDkGA1b263DhKElM+fDqc1mirb3lNYUdo17 X-Gm-Gg: ASbGncuMGGkLyYNEE9dRc2MBR44SmWrSFbaL9B6KSRkTPlpYTVKf0gQTI4QLHH4Bb9O mThPuZ/DRlAtSOUzBFC6jCVvAL3thUyITGzCLLvz4YkrHAQsJ/UkfveQnu1JBCCszMmJPt5vBdI 42gUF9sc40kUOYcCnLMAaZbUjYClRRG59w1e7NeCQ5lMSJ/lNLj3YU4giJh1gc3mHE+YPt0HrfX oBBkgzKTRcPSKlg3B7Nk1WDoVMvEVajMVdyZ9iv+Pc2L2OoDYkDMT/4SOYVeTf5RQuxMr6hZYAE zMR7PLHdi17+2bsjcCOFnQ7MU+Rwvrjec3WME6dknJMlqcXUeJFq9E9cbB/EDCcIP1qobpkIEjt d/RwAyKbJdmw5RzizRT8MNPIV312keaa0FRsXSoBlIwS4bifzNdFCbwgmR0A4tZjTJrbtmQ== X-Google-Smtp-Source: AGHT+IFUcRCQeMaYJ7t5ibtjqOdnYqWZt4BZE4/lbl8FgIpimjzxFWCXYdULjNIvuVWYxq+qGJIJSQ== X-Received: by 2002:a05:6902:2884:b0:e90:6ea3:1e0f with SMTP id 3f1490d57ef6-e94f651abe9mr1262184276.7.1755653987135; Tue, 19 Aug 2025 18:39:47 -0700 (PDT) Received: from smtpclient.apple (cm-24-53-143-223.buckeyecom.net. [24.53.143.223]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e9332845f84sm4636294276.27.2025.08.19.18.39.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Aug 2025 18:39:46 -0700 (PDT) From: JD Smith Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: 30.2.50; overlay line-prefix display property fighting with text display property Message-Id: Date: Tue, 19 Aug 2025 21:39:38 -0400 To: bug-gnu-emacs@gnu.org X-Mailer: Apple Mail (2.3826.700.81) Received-SPF: pass client-ip=2607:f8b0:4864:20::b32; envelope-from=jdtsmith@gmail.com; helo=mail-yb1-xb32.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) An overlay which applies a line-prefix (e.g. to set the fringe) across = several lines conflicts with underlying text which has a replacing = display property set. Evaluate the following in the *scratch* buffer, = with at least 3 blank lines at the top of the buffer. (progn (delete-all-overlays) (let ((ov (make-overlay 1 4))) (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display '(left-fringe = right-triangle success)))) (put-text-property 2 3 'display ">testing fringe display")) The result is very strange: the SHOULDNOTSEETHIS prefix string appears = (sans fringe display), but then vanishes on the next redisplay. Some = (well-balanced) fight between overlay line-prefix display and normal = display properties seems to be occurring.= From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 20 09:35:32 2025 Received: (at 79275) by debbugs.gnu.org; 20 Aug 2025 13:35:32 +0000 Received: from localhost ([127.0.0.1]:56480 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uoiyS-0000dW-Cu for submit@debbugs.gnu.org; Wed, 20 Aug 2025 09:35:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47346) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uoiyP-0000dG-R0 for 79275@debbugs.gnu.org; Wed, 20 Aug 2025 09:35:30 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uoiyJ-000607-5o; Wed, 20 Aug 2025 09:35:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=LjAE2tOZPl6Jy4VhkPrcXuqPpTcAmJIoAy5+8L+T6EM=; b=cFiOi/9U+6sO 7P/3a7+6tZBg11AeYGAcuvQ6Nx9bizU4zUIAR2yc/MYn8uyMe6BprbBOqAthqfzzU/rMsMk+SGQys BzENQlV05nSHesMmtRA+B+E31eh8davcgLqIk4sjvIPDI/cVcO9qG39lSJCTALqzBn9W4vNDmNOyq nUD8Z2lzlUDjovfJ1kgRz/fI+V1aSSbLlOlZ3RE/boNDo306JaXpg/yVzxequSQhnn6s0FqUvXGIG uLnsO/28WmnNfYafMMSIIq+ueNHKuQRoTOrXBNUaXm5xIrEnMyyvDU6Me5Zw+Dg8r9P5ddcZsvXt1 oYrpQOuvOY5w06hYK4UunQ==; Date: Wed, 20 Aug 2025 16:35:20 +0300 Message-Id: <86frdmf753.fsf@gnu.org> From: Eli Zaretskii To: JD Smith In-Reply-To: (message from JD Smith on Tue, 19 Aug 2025 21:39:38 -0400) Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79275 Cc: 79275@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: JD Smith > Date: Tue, 19 Aug 2025 21:39:38 -0400 > > An overlay which applies a line-prefix (e.g. to set the fringe) across several lines conflicts with underlying text which has a replacing display property set. Evaluate the following in the *scratch* buffer, with at least 3 blank lines at the top of the buffer. > > (progn > (delete-all-overlays) > (let ((ov (make-overlay 1 4))) > (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display > '(left-fringe right-triangle success)))) > (put-text-property 2 3 'display ">testing fringe display")) > > The result is very strange: the SHOULDNOTSEETHIS prefix string appears (sans fringe display), but then vanishes on the next redisplay. Some (well-balanced) fight between overlay line-prefix display and normal display properties seems to be occurring. Thanks. One of the redisplay optimizations we use couldn't cope with this tricky situation (a line-prefix immediately followed by a display string at the beginning of a line), and needs to be disabled in this case. Does the patch below give good results? diff --git a/src/xdisp.c b/src/xdisp.c index 2691296..6026038 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7261,6 +7261,8 @@ push_it (struct it *it, struct text_pos *position) p->from_disp_prop_p = it->from_disp_prop_p; ++it->sp; + it->string_from_prefix_prop_p = false; + /* Save the state of the bidi iterator as well. */ if (it->bidi_p) bidi_push_it (&it->bidi_it); @@ -22657,8 +22659,23 @@ #define GIVE_UP(X) return 0 /* Give up if the row starts with a display property that draws on the fringes, since that could prevent correct display of line-prefix and wrap-prefix. */ - if (it.sp > 1 - && it.method == GET_FROM_IMAGE && it.image_id == -1) + if ((it.sp > 1 + && it.method == GET_FROM_IMAGE && it.image_id == -1) + /* Give up if there's a line/wrap-prefix property on buffer + text, and the row begins with a display or overlay string. + This is because in that case the iterator state produced by + init_to_row_end is already set to the display/overlay + string, and thus cannot be used to display the prefix + before the display/overlay string. */ + || (it.sp == 1 + && it.method == GET_FROM_STRING + && !it.string_from_prefix_prop_p + && (!NILP (Fget_char_property (make_fixnum (IT_CHARPOS (it)), + Qline_prefix, + it.w->contents)) + || !NILP (Fget_char_property (make_fixnum (IT_CHARPOS (it)), + Qwrap_prefix, + it.w->contents))))) GIVE_UP (26); start_pos = it.current.pos; From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 20 11:06:34 2025 Received: (at 79275) by debbugs.gnu.org; 20 Aug 2025 15:06:34 +0000 Received: from localhost ([127.0.0.1]:57287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uokOX-0005Oh-D7 for submit@debbugs.gnu.org; Wed, 20 Aug 2025 11:06:33 -0400 Received: from mail-yw1-x1132.google.com ([2607:f8b0:4864:20::1132]:43484) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1uokOR-0005OE-Id for 79275@debbugs.gnu.org; Wed, 20 Aug 2025 11:06:31 -0400 Received: by mail-yw1-x1132.google.com with SMTP id 00721157ae682-71fb85c4b59so7510467b3.1 for <79275@debbugs.gnu.org>; Wed, 20 Aug 2025 08:06:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755702381; x=1756307181; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=U0tESm+2qPYxFxbWoVEhuUAIi4pjI+McrPquSJ6CiLw=; b=P41RtjLVo2alovwUaTPDgUXS/ZVAm2C35qBrDA4WNR6zoPU59w259WBDxYXwApCdp5 z80q9cS31lzxYazsQgJDkKwqOk01hzy9tUzUMrg8QxV3gi9b2FQxY3CUBWuvmSCION5o SBQdLb0alWHxnVaGVr3QigWpYOdNc/DLklC9utrbI+JiZbfMrlBEot88Jwd6UAe/67h3 QVkwLnMfPI3Q8zZUl0zjJEwOLyZcZBhX3WsgdsZsU855IAISE9MOUUUA7okn2W1JiZsz +ju6MkrzEtu0hL3wQTA/SJmfYxy9wwcfneIxJIMjVP17fK1YJ/fHK6sfjjeoKGzbb8ko eQaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755702381; x=1756307181; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=U0tESm+2qPYxFxbWoVEhuUAIi4pjI+McrPquSJ6CiLw=; b=LsNaDGoyWV2Sx2sg2akzvNj+Cgr0ujr26joZ8BKeSF4f6wlM80v+PY05Zik/KbQvPy FpBN8mz4uJV3dhwTCUA167oz9Qs2hQMVldvtE/wtfLyDs78i1S0T5ZA/abQRjxMyuEG7 Jtq1HvINmtNYPwpHPuFmi+uYbnI46ZQmgQEbSN4A56dhA37ReLmgu8qioLS0nwdq2B9w 2PUl7rDT4WG8WTWTxcTQvlzHWVxlo3jCiKseI1tcmXqYB+LqVB3WI4ChiMFGAn7aEoqE Hj17/FzOeKaXujih/a1yjNNTcC+nLrNmtAPFNuPFxiZh9negFEpaV6p66uCdUaym71L2 x+mQ== X-Gm-Message-State: AOJu0YyoR25lDy3bi3lTboDaokB7sifKzE3uze5d5t9vVrtq/6Xxgd38 RCxfwEmwtsGdAwFrkBwu3BdEXQ+SHFoe2kUy2ZudxWNZME5DNjpaPiom3p0RVbPl X-Gm-Gg: ASbGncuKS6S8pziVqBPESQAIvQ7o6LUGCHcPCEToZHZ2Ld+v/eauPofUVpe6H1kV/KA OTuLgFTIbzcNOuknMuVJRkKDeX2+Y0GNpFjLpdOQ/GaO+YRCRLi/Yv+Hk0xttV1vM2RmAe6iZwN qh9ZjuUtLhx3vgLSEiw2y7wReWK+tCYNbHH8WW1ePvOfMFCBT/1x18ojmGzXBwAksVis5e9G7AW v8E988CiVZWq9Z47yryKdsDK2UwBs3psUYf5cgUjm6ddUWV1MEBvMGmC+mC2xa/IvymbV6QKHwk hVuarKqUStY6ADU7duJmfvVOVgN/HL6L9q8Z5qUs127YbUyWNlLW/ghUEf1eUsYnxGZC2MbgI8i 0ToIeW4U2/zwnQvcOr0ZGMcLWepNnRyFt5e/hKGCbw4RpblQyA9adFkNO X-Google-Smtp-Source: AGHT+IHmBdmUWr1h6vU8cq7vcVPZ5NGSy77heT119zhGHPjQpzsCZIj0GJqi8hBDXZyIjrhq3Z275w== X-Received: by 2002:a05:690c:6605:b0:71a:31cd:1848 with SMTP id 00721157ae682-71fb1e7464dmr38440997b3.14.1755702381115; Wed, 20 Aug 2025 08:06:21 -0700 (PDT) Received: from moss-4 (cm-24-53-143-223.buckeyecom.net. [24.53.143.223]) by smtp.gmail.com with ESMTPSA id 00721157ae682-71fba5eeab8sm3599397b3.32.2025.08.20.08.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Aug 2025 08:06:20 -0700 (PDT) From: "J.D. Smith" To: Eli Zaretskii Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property In-Reply-To: <86frdmf753.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 20 Aug 2025 16:35:20 +0300") References: <86frdmf753.fsf@gnu.org> Date: Wed, 20 Aug 2025 11:06:20 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79275 Cc: 79275@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: JD Smith >> Date: Tue, 19 Aug 2025 21:39:38 -0400 >> >> An overlay which applies a line-prefix (e.g. to set the fringe) across several lines conflicts with underlying text which has a replacing display property set. Evaluate the following in the *scratch* buffer, with at least 3 blank lines at the top of the buffer. >> >> (progn >> (delete-all-overlays) >> (let ((ov (make-overlay 1 4))) >> (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display >> '(left-fringe right-triangle success)))) >> (put-text-property 2 3 'display ">testing fringe display")) >> >> The result is very strange: the SHOULDNOTSEETHIS prefix string appears (sans fringe display), but then vanishes on the next redisplay. Some (well-balanced) fight between overlay line-prefix display and normal display properties seems to be occurring. > > Thanks. > > One of the redisplay optimizations we use couldn't cope with this > tricky situation (a line-prefix immediately followed by a display > string at the beginning of a line), and needs to be disabled in this > case. > > Does the patch below give good results? Yes it does, thanks. There still appears to be another corner case, however. If the conflict occurs at the /beginning/ of the overlay: (progn (delete-all-overlays) (let ((ov (make-overlay 1 4))) (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display '(left-fringe right-triangle success)))) (put-text-property 1 2 'display ">testing fringe display")) ;; changed from 2->3 to 1->2 SHOULDNOTSEETHIS still appears (and remains). That situation is what actually motivated the report. From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 20 12:13:46 2025 Received: (at 79275) by debbugs.gnu.org; 20 Aug 2025 16:13:46 +0000 Received: from localhost ([127.0.0.1]:57457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uolRZ-0000P5-MC for submit@debbugs.gnu.org; Wed, 20 Aug 2025 12:13:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55178) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uolRX-0000Oe-0W for 79275@debbugs.gnu.org; Wed, 20 Aug 2025 12:13:43 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uolRR-0005Jh-KF; Wed, 20 Aug 2025 12:13:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=uRhdBIinhub3obiGQ3+J3UtVo/bMNNN5uYdnwRIqvVI=; b=NE8FmzXeCxLl zpO7TNsfnk3wUIMMHpV5v13+mQxS9pHfnYbpszT3ApjqW4+gDo5FY2Gts2xRwPg4LKDs3Uzw7kcwj ValSr7yj5qmrc90sRU5LeX3iL0ESpunmI5uBnzOMDsZH+aEx23qTZH9gemwDDDjwP1D5Tl7BS5Vc5 E3AJMelNE1aDnLfz6BjTdRhJ0HsX2YE+bvGUqei6D35OCrNiKtIBJg3P/kuWwstGdpoG+vQRDuiEa cwHmD+HAEPyTqV+HXtZQ3PLjyU/+FnaSSlfn0L5uvg/5isHeXgYH6/5NKVppdfp30XTeygPWOCZEM JdPw8vO94stXKWIJPDzKSg==; Date: Wed, 20 Aug 2025 19:13:30 +0300 Message-Id: <86349mezth.fsf@gnu.org> From: Eli Zaretskii To: "J.D. Smith" In-Reply-To: (jdtsmith@gmail.com) Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property References: <86frdmf753.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79275 Cc: 79275@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: "J.D. Smith" > Cc: 79275@debbugs.gnu.org > Date: Wed, 20 Aug 2025 11:06:20 -0400 > > Eli Zaretskii writes: > > >> From: JD Smith > >> Date: Tue, 19 Aug 2025 21:39:38 -0400 > >> > >> An overlay which applies a line-prefix (e.g. to set the fringe) across several lines conflicts with underlying text which has a replacing display property set. Evaluate the following in the *scratch* buffer, with at least 3 blank lines at the top of the buffer. > >> > >> (progn > >> (delete-all-overlays) > >> (let ((ov (make-overlay 1 4))) > >> (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display > >> '(left-fringe right-triangle success)))) > >> (put-text-property 2 3 'display ">testing fringe display")) > >> > >> The result is very strange: the SHOULDNOTSEETHIS prefix string appears (sans fringe display), but then vanishes on the next redisplay. Some (well-balanced) fight between overlay line-prefix display and normal display properties seems to be occurring. > > > > Thanks. > > > > One of the redisplay optimizations we use couldn't cope with this > > tricky situation (a line-prefix immediately followed by a display > > string at the beginning of a line), and needs to be disabled in this > > case. > > > > Does the patch below give good results? > > Yes it does, thanks. There still appears to be another corner case, > however. If the conflict occurs at the /beginning/ of the overlay: > > (progn > (delete-all-overlays) > (let ((ov (make-overlay 1 4))) > (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display > '(left-fringe right-triangle success)))) > (put-text-property 1 2 'display ">testing fringe display")) ;; changed from 2->3 to 1->2 > > SHOULDNOTSEETHIS still appears (and remains). That situation is what > actually motivated the report. That's a completely different problem, and I've run out of free time for debugging this stuff today. So this will have to wait till I have time again. Or maybe someone else will beat me to it. In the future, please make an effort to describe all of the situations you found that produce unexpected results, especially if some situation was the original motivation for the bug report. It is not easy for me to find enough time to set up a debugging session and step through this tricky code, so I prefer not to invest that overhead more than just once for a given bug report. Please keep that in mind when you decide what to tell and what not to tell, and please don't assume that everything you see is the consequence of the same problem in the code. TIA From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 21 14:14:11 2025 Received: (at 79275) by debbugs.gnu.org; 21 Aug 2025 18:14:11 +0000 Received: from localhost ([127.0.0.1]:32923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1up9ne-0004Al-VQ for submit@debbugs.gnu.org; Thu, 21 Aug 2025 14:14:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40358) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1up9nc-0004AW-Rt for 79275@debbugs.gnu.org; Thu, 21 Aug 2025 14:14:09 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1up9nX-0006S3-Dl; Thu, 21 Aug 2025 14:14:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sFlq8oYDfL3XIWuFE/tqfYM8dBaWVIO6vd/nHm9Jhd0=; b=bxyg+cPIsOSs D66BWfh3qjTIEfkIdgQUFowEs2188FHUbvdULT3pikYfJpJz6fwEup5LyIkeFfDzHFXaCBZeGn9k1 COHl9xkjTXkcMjhZYSaWEc9NOH63ro8MjjQqPkYFzcGLHJ1XboxZy0VA5gSo0JyMxVnw1DYBKPYsF FPVhioV9pDuCY/3RhHWJHWtQ45vtO22MX5Aw7Ce1WEqlAu8KXknYeKhj5e4Kec+4tJNZpN/qwXL8f eg0JMMl3hP0mT6TPjnAML9mePuRGsGpz/soXM1y7VjA/pcTOzhS3+HWF3qZOiRnylmHUsdMKVjeoY ATFzFoemwS8ECn+2XKGPBA==; Date: Thu, 21 Aug 2025 21:13:58 +0300 Message-Id: <861pp4ee55.fsf@gnu.org> From: Eli Zaretskii To: "J.D. Smith" In-Reply-To: (jdtsmith@gmail.com) Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property References: <86frdmf753.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79275 Cc: 79275@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: "J.D. Smith" > Cc: 79275@debbugs.gnu.org > Date: Wed, 20 Aug 2025 11:06:20 -0400 > > Eli Zaretskii writes: > > >> From: JD Smith > >> Date: Tue, 19 Aug 2025 21:39:38 -0400 > >> > >> An overlay which applies a line-prefix (e.g. to set the fringe) across several lines conflicts with underlying text which has a replacing display property set. Evaluate the following in the *scratch* buffer, with at least 3 blank lines at the top of the buffer. > >> > >> (progn > >> (delete-all-overlays) > >> (let ((ov (make-overlay 1 4))) > >> (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display > >> '(left-fringe right-triangle success)))) > >> (put-text-property 2 3 'display ">testing fringe display")) > >> > >> The result is very strange: the SHOULDNOTSEETHIS prefix string appears (sans fringe display), but then vanishes on the next redisplay. Some (well-balanced) fight between overlay line-prefix display and normal display properties seems to be occurring. > > > > Thanks. > > > > One of the redisplay optimizations we use couldn't cope with this > > tricky situation (a line-prefix immediately followed by a display > > string at the beginning of a line), and needs to be disabled in this > > case. > > > > Does the patch below give good results? > > Yes it does, thanks. There still appears to be another corner case, > however. If the conflict occurs at the /beginning/ of the overlay: > > (progn > (delete-all-overlays) > (let ((ov (make-overlay 1 4))) > (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display > '(left-fringe right-triangle success)))) > (put-text-property 1 2 'display ">testing fringe display")) ;; changed from 2->3 to 1->2 > > SHOULDNOTSEETHIS still appears (and remains). That situation is what > actually motivated the report. Please try the patch below, I hope it fixes both of the situations you described. diff --git a/src/xdisp.c b/src/xdisp.c index 2691296..b8088f6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -7261,6 +7261,8 @@ push_it (struct it *it, struct text_pos *position) p->from_disp_prop_p = it->from_disp_prop_p; ++it->sp; + it->string_from_prefix_prop_p = false; + /* Save the state of the bidi iterator as well. */ if (it->bidi_p) bidi_push_it (&it->bidi_it); @@ -22657,8 +22659,23 @@ #define GIVE_UP(X) return 0 /* Give up if the row starts with a display property that draws on the fringes, since that could prevent correct display of line-prefix and wrap-prefix. */ - if (it.sp > 1 + if ((it.sp > 1 && it.method == GET_FROM_IMAGE && it.image_id == -1) + /* Give up if there's a line/wrap-prefix property on buffer + text, and the row begins with a display or overlay string. + This is because in that case the iterator state produced by + init_to_row_end is already set to the display/overlay + string, and thus cannot be used to display the prefix + before the display/overlay string. */ + || (it.sp == 1 + && it.method == GET_FROM_STRING + && !it.string_from_prefix_prop_p + && (!NILP (Fget_char_property (make_fixnum (IT_CHARPOS (it)), + Qline_prefix, + it.w->contents)) + || !NILP (Fget_char_property (make_fixnum (IT_CHARPOS (it)), + Qwrap_prefix, + it.w->contents))))) GIVE_UP (26); start_pos = it.current.pos; @@ -24710,15 +24727,29 @@ cursor_row_p (struct glyph_row *row) /* Push the property PROP so that it will be rendered at the current - position in IT. Return true if PROP was successfully pushed, false - otherwise. Called from handle_line_prefix to handle the - `line-prefix' and `wrap-prefix' properties. */ + position in IT. FROM_BUFFER non-zero means the property was found on + buffer text, even though IT is set to iterate a string. + Return true if PROP was successfully pushed, false otherwise. + Called from handle_line_prefix to handle the `line-prefix' and + `wrap-prefix' properties. */ static bool -push_prefix_prop (struct it *it, Lisp_Object prop) +push_prefix_prop (struct it *it, Lisp_Object prop, int from_buffer) { - struct text_pos pos = - STRINGP (it->string) ? it->current.string_pos : it->current.pos; + struct text_pos pos; + + if (STRINGP (it->string)) + { + if (from_buffer) /* a string, but prefix property from buffer */ + pos = it->current.string_pos; + else /* a string and prefix property from string */ + pos.charpos = pos.bytepos = 0; /* we have yet to iterate that string */ + } + else /* a buffer and prefix property from buffer */ + pos = it->current.pos; + + bool phoney_display_string = + from_buffer && STRINGP (it->string) && it->string_from_display_prop_p; eassert (it->method == GET_FROM_BUFFER || it->method == GET_FROM_DISPLAY_VECTOR @@ -24737,6 +24768,13 @@ push_prefix_prop (struct it *it, Lisp_Object prop) it->position not yet set when this function is called. */ push_it (it, &pos); + /* Reset this flag, since it is not relevant (comes from a display + string that follows iterator position). If we don't do that, any + display properties on the prefix string will be ignored. The call + to pop_it when we are done with the prefix will restore the flag. */ + if (phoney_display_string) + it->string_from_display_prop_p = false; + if (STRINGP (prop)) { if (SCHARS (prop) == 0) @@ -24794,7 +24832,7 @@ push_prefix_prop (struct it *it, Lisp_Object prop) #endif /* HAVE_WINDOW_SYSTEM */ else { - pop_it (it); /* bogus display property, give up */ + pop_it (it); /* bogus prefix property, give up */ return false; } @@ -24806,11 +24844,14 @@ push_prefix_prop (struct it *it, Lisp_Object prop) static Lisp_Object get_it_property (struct it *it, Lisp_Object prop) { - Lisp_Object position, object = it->object; + Lisp_Object position, object; - if (STRINGP (object)) - position = make_fixnum (IT_STRING_CHARPOS (*it)); - else if (BUFFERP (object)) + if (STRINGP (it->string)) + { + position = make_fixnum (IT_STRING_CHARPOS (*it)); + object = it->string; + } + else if (BUFFERP (it->object)) { position = make_fixnum (IT_CHARPOS (*it)); object = it->window; @@ -24825,15 +24866,21 @@ get_it_property (struct it *it, Lisp_Object prop) current IT->OBJECT and the underlying buffer text. */ static Lisp_Object -get_line_prefix_it_property (struct it *it, Lisp_Object prop) +get_line_prefix_it_property (struct it *it, Lisp_Object prop, + int *from_buffer) { Lisp_Object prefix = get_it_property (it, prop); + *from_buffer = false; + /* If we are looking at a display or overlay string, check also the underlying buffer text. */ - if (NILP (prefix) && it->sp > 0 && STRINGP (it->object)) - return Fget_char_property (make_fixnum (IT_CHARPOS (*it)), prop, - it->w->contents); + if (NILP (prefix) && it->sp > 0 && STRINGP (it->string)) + { + *from_buffer = true; + return Fget_char_property (make_fixnum (IT_CHARPOS (*it)), prop, + it->w->contents); + } return prefix; } @@ -24844,21 +24891,22 @@ handle_line_prefix (struct it *it) { Lisp_Object prefix; bool wrap_prop = false; + int from_buffer; if (it->continuation_lines_width > 0) { - prefix = get_line_prefix_it_property (it, Qwrap_prefix); + prefix = get_line_prefix_it_property (it, Qwrap_prefix, &from_buffer); if (NILP (prefix)) prefix = Vwrap_prefix; wrap_prop = true; } else { - prefix = get_line_prefix_it_property (it, Qline_prefix); + prefix = get_line_prefix_it_property (it, Qline_prefix, &from_buffer); if (NILP (prefix)) prefix = Vline_prefix; } - if (! NILP (prefix) && push_prefix_prop (it, prefix)) + if (! NILP (prefix) && push_prefix_prop (it, prefix, from_buffer)) { /* If the prefix is wider than the window, and we try to wrap it, it would acquire its own wrap prefix, and so on till the From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 21 15:46:14 2025 Received: (at 79275) by debbugs.gnu.org; 21 Aug 2025 19:46:14 +0000 Received: from localhost ([127.0.0.1]:33080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upBEk-00004z-8b for submit@debbugs.gnu.org; Thu, 21 Aug 2025 15:46:14 -0400 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]:52553) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1upBEh-0008WM-CX for 79275@debbugs.gnu.org; Thu, 21 Aug 2025 15:46:11 -0400 Received: by mail-yb1-xb32.google.com with SMTP id 3f1490d57ef6-e94fc1e693fso1452446276.1 for <79275@debbugs.gnu.org>; Thu, 21 Aug 2025 12:46:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1755805565; x=1756410365; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=/xsHXp3NP8VB3hU9CxWI8ALkFYh2HHG44ySi9IIU4go=; b=QED/h2lrrjRxCO50n6YC1WzuTBOtQ+nVAwKpcyROVGDv7Qw/3SV2Xm1u4zgj6m0GmS zJwtyVBgWoehTd0BFJc5X0/xK5/g6crod6W8zoABqylYgugwgV26dGk/wopI08mCMntA GQRUudHzIcFl6RuMAP+Dc3meAo0sWn54NPwYQXH2hlNMmEh8fSHbnMV/X1+yl8Gfg6zX kRtCeY0ZwKYBqKjv7czWCf4+K13CCKv+csCLkxEC7b1mpE0vE5uMBH+JoYxHl5AycmJF 2n8ZepZruHoUO/1AjEXNKnMU+8uqXtTJtAxtT0P4I2WFurd9BbcVY83/3nkKAnJy2AAh KsKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1755805565; x=1756410365; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/xsHXp3NP8VB3hU9CxWI8ALkFYh2HHG44ySi9IIU4go=; b=PkLXH2+Q/umEhoUeD8M0oFV/1PjHRYeQ34vNGk9urwP792r4qQ+usdYbEBGyVfdRvt oyT33XNJrefMpBFUGY0lgYqac1ddIP4tAee5Gsoc/msJWLkIKkE8m8n7d1KCoeftTVnB QLriNaUxuulfgG/itZE803FM83lbrOEhapYUAhN6BiP+L3+661DFK3msYQU8y75/nkBV mIiz4LTkEmOxPrUrqXifUzXXzUHtlH/2/QLAMkaRk6ph/mgJewyigrT9F4Hog0TMONEc cymhwtwH/KgduY+ijd8By4IX8Mx4BQYDYc12qUw/fDjWg+3WarbIJABrHVmMpaUxWtqM SMpQ== X-Gm-Message-State: AOJu0YyoGw25S79BL4dscsoX4jXU4/RDDeJL/qjO+CA3qErC59kBB1ml OZsXfpo55ye95Mvfk/AIHPmI4JAsFYGXR6UJ9szxRQmFwQcVsSLNTVsUXtR4yQ== X-Gm-Gg: ASbGncs+qJT51PU33cHXnsQJyMq9WACI1m/zZWijnOJSPZYKikn0SmcrwCkSAOEbEx+ eO/MYyyWEbkH+Fs/nBdzk0tXp7LwHdD0D7P4rVRfxJllJIDe0nuNeL/zfzsnQ7KRaRmzOyAbvZq 9gGv0Vo47yc6vzHFDaycgFN+BxFr+EwzpEuIRHtkSbF5txh9zi25kGW++QE/o8a34uyinQ2l0UF eY86ojaZHucpcP5ggSonX/DN4lOA0fg5BapQnI5n1yZtS94N+pi+6iouXwRZ8spJpf52wgkyTV1 ecgN5HP36IYnkMrwYW5Wdj6jXOjkHBSx4eFL4wwO67vmm094YlBN4b5nqpncr8oY/gHitQ+sksS Qw4Vu1FQnkwATaHUTy9RzCs+N X-Google-Smtp-Source: AGHT+IF9G2L1/uLavRK/+96VEgTXAuudE9psmIMA8ivslxFl8XtMXdm4ZFJcr/XEe5vvOFAfxds+PA== X-Received: by 2002:a05:6902:100b:b0:e93:48a1:5b01 with SMTP id 3f1490d57ef6-e951c2c83a5mr816525276.7.1755805565049; Thu, 21 Aug 2025 12:46:05 -0700 (PDT) Received: from moss-4 ([131.183.131.33]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e95027f65e0sm1331130276.10.2025.08.21.12.46.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Aug 2025 12:46:04 -0700 (PDT) From: "J.D. Smith" To: Eli Zaretskii Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property In-Reply-To: <861pp4ee55.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 21 Aug 2025 21:13:58 +0300") References: <86frdmf753.fsf@gnu.org> <861pp4ee55.fsf@gnu.org> Date: Thu, 21 Aug 2025 15:46:03 -0400 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 79275 Cc: 79275@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: > Please try the patch below, I hope it fixes both of the situations you > described. Your latest patch indeed fixes this display conflict between overlays and text properties at both the front of a fringe-displaying overlay and in its middle. The code I used to test: ;; Insert at least 4 blank lines above this and evaluate (progn (delete-all-overlays) (let ((ov (make-overlay 1 5))) (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display '(left-fringe right-triangle success)))) (put-text-property 1 2 'display ">testing front-fringe display\n") (put-text-property 3 4 'display ">testing mid-fringe display\n")) Thanks very much for your work on this. I know how challenging it can be to hunt down subtle bugs in the redisplay code. I appreciate all the time and energy you volunteer to continuously improve Emacs. From debbugs-submit-bounces@debbugs.gnu.org Fri Aug 22 02:49:56 2025 Received: (at 79275) by debbugs.gnu.org; 22 Aug 2025 06:49:56 +0000 Received: from localhost ([127.0.0.1]:34449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upLb1-0000Dz-LR for submit@debbugs.gnu.org; Fri, 22 Aug 2025 02:49:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38120) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1upLaz-0000Di-CG for 79275@debbugs.gnu.org; Fri, 22 Aug 2025 02:49:53 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1upLat-0001d6-Ky; Fri, 22 Aug 2025 02:49:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=k/oL2G0ICPuuEojawboADFg116TFu+UPkWqtPC4W39k=; b=GdLdU/b4Sng4 jdpmaI65l+EaOXBu/bzggJ8qQP1Dmavmz8ZOJ0CvnmbtER+vobKQhqmenE2Zg30M4Uw4+/r3Vg+E0 +yG5EEEXksvXqRn54OzfRHpcWZTLL8ZK66DiHqckHAuTkQ0YoHMWqQ15YCiPEiNDGCyb+dv2+/yar +16YN6tC1Sh0xNyTl3C4QrXN5gmjrOLm8LltTipd9rsZEdXS5vWq3iwA3OEwXrETkbFbJXFxPnlaf x/NNTtGNApK2woqXAx6NUZNU06w87hbnTdg9ylbHa2wycJgrw9KVXcbBtV1zqKga5uiFvFLnABpGh 4c+NMiCl4AIWDiOBjgYpuQ==; Date: Fri, 22 Aug 2025 09:49:04 +0300 Message-Id: <86tt1zdf6n.fsf@gnu.org> From: Eli Zaretskii To: "J.D. Smith" In-Reply-To: (jdtsmith@gmail.com) Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property References: <86frdmf753.fsf@gnu.org> <861pp4ee55.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79275 Cc: 79275@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: "J.D. Smith" > Cc: 79275@debbugs.gnu.org > Date: Thu, 21 Aug 2025 15:46:03 -0400 > > Eli Zaretskii writes: > > > Please try the patch below, I hope it fixes both of the situations you > > described. > > Your latest patch indeed fixes this display conflict between overlays > and text properties at both the front of a fringe-displaying overlay and > in its middle. The code I used to test: > > ;; Insert at least 4 blank lines above this and evaluate > (progn > (delete-all-overlays) > (let ((ov (make-overlay 1 5))) > (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display > '(left-fringe right-triangle success)))) > (put-text-property 1 2 'display ">testing front-fringe display\n") > (put-text-property 3 4 'display ">testing mid-fringe display\n")) > > Thanks very much for your work on this. I know how challenging it can > be to hunt down subtle bugs in the redisplay code. I appreciate all the > time and energy you volunteer to continuously improve Emacs. Thanks for testing. I will run a few more tests before installing this: as you could see, this bug revealed a couple of serious design blunders in how line/wrap-prefix was implemented, so I'd like to make sure the changes didn't break anything. What astonished me the most was the use of it->object to decide whether we iterate a buffer or a string, something that I learned long ago (and forgot) to be a very bad idea, see this comment in dispextern.h: Do NOT use !BUFFERP (it.object) as a test whether we are iterating over a string; use STRINGP (it.string) instead. From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 23 04:39:07 2025 Received: (at 79275-done) by debbugs.gnu.org; 23 Aug 2025 08:39:07 +0000 Received: from localhost ([127.0.0.1]:38671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1upjmE-0008FB-UU for submit@debbugs.gnu.org; Sat, 23 Aug 2025 04:39:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47340) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1upjmD-0008Ei-13 for 79275-done@debbugs.gnu.org; Sat, 23 Aug 2025 04:39:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1upjm7-0007dI-OK; Sat, 23 Aug 2025 04:38:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=WKPWMsxBN5om5iZolh4LnA4pfOxV6TI3kF0XV2bgpyo=; b=pGFsCJzaewID ZMuUktW2b9wzwGDp4RqP5dRaFEqakaRivmRWiJtbHynz7bbsi86JwoGuZybCCTVLRbjWpyz+yGsEz LZciCbcHn4h9t2+icBiR0pmRNkcMP0NClOqrxIq+t07QnHd8BCSK1LTp6aGQAG0DF91yE14rNLdkQ jP6Dgi2CndOjst0pbOHnX+TUu2AspUhF2/42uLTee0tE3M7+G6AYEhApixeqBois+l5W6MOHk9ock JP+kL7LEmZY2aaIvvYuzKz1tsM6zHh88uC8pjuSSGVrnmwvSrUOk1o6LWdyjxv/AafX/eAbLzShO2 IhgxmD6144q6HZznu29ajw==; Date: Sat, 23 Aug 2025 11:38:56 +0300 Message-Id: <864ityctzz.fsf@gnu.org> From: Eli Zaretskii To: jdtsmith@gmail.com In-Reply-To: <86tt1zdf6n.fsf@gnu.org> (message from Eli Zaretskii on Fri, 22 Aug 2025 09:49:04 +0300) Subject: Re: bug#79275: 30.2.50; overlay line-prefix display property fighting with text display property References: <86frdmf753.fsf@gnu.org> <861pp4ee55.fsf@gnu.org> <86tt1zdf6n.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79275-done Cc: 79275-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 79275@debbugs.gnu.org > Date: Fri, 22 Aug 2025 09:49:04 +0300 > From: Eli Zaretskii > > > From: "J.D. Smith" > > Cc: 79275@debbugs.gnu.org > > Date: Thu, 21 Aug 2025 15:46:03 -0400 > > > > Eli Zaretskii writes: > > > > > Please try the patch below, I hope it fixes both of the situations you > > > described. > > > > Your latest patch indeed fixes this display conflict between overlays > > and text properties at both the front of a fringe-displaying overlay and > > in its middle. The code I used to test: > > > > ;; Insert at least 4 blank lines above this and evaluate > > (progn > > (delete-all-overlays) > > (let ((ov (make-overlay 1 5))) > > (overlay-put ov 'line-prefix (propertize "SHOULDNOTSEETHIS" 'display > > '(left-fringe right-triangle success)))) > > (put-text-property 1 2 'display ">testing front-fringe display\n") > > (put-text-property 3 4 'display ">testing mid-fringe display\n")) > > > > Thanks very much for your work on this. I know how challenging it can > > be to hunt down subtle bugs in the redisplay code. I appreciate all the > > time and energy you volunteer to continuously improve Emacs. > > Thanks for testing. I will run a few more tests before installing > this: as you could see, this bug revealed a couple of serious design > blunders in how line/wrap-prefix was implemented, so I'd like to make > sure the changes didn't break anything. > > What astonished me the most was the use of it->object to decide > whether we iterate a buffer or a string, something that I learned long > ago (and forgot) to be a very bad idea, see this comment in > dispextern.h: > > Do NOT use !BUFFERP (it.object) as a test whether we are > iterating over a string; use STRINGP (it.string) instead. > The fix is now installed on the master branch. Closing the bug.