From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73600: 31.0.50; Visual wrap prefix mode and image display Date: Sat, 12 Oct 2024 15:00:16 +0300 Message-ID: <86plo5wmy7.fsf@gnu.org> References: <87wmiq1wsd.fsf@gautierponsinet.xyz> <86cyki1pgu.fsf@gnu.org> <86bk021p1k.fsf@gnu.org> <3117d4b7-751c-8c6d-8acf-48dc6464e723@gmail.com> <86h69tzc2w.fsf@gnu.org> <57d753c5-538d-d026-2f41-2a0eaddef746@gmail.com> <86v7y8xtyi.fsf@gnu.org> <867canxda6.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14519"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 73600@debbugs.gnu.org, gautier@gautierponsinet.xyz To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 12 14:10:07 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1szawh-0003bh-5i for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 12 Oct 2024 14:10:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1szawQ-0000SC-P8; Sat, 12 Oct 2024 08:09:50 -0400 Original-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 1szawP-0000RU-25 for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 08:09:49 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1szawO-00021S-OF for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 08:09:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=GvfilIx2Os7GA1wHC1NMZ9TC5McZk7wZNiG+cZ0C+2M=; b=pTrF7IXM/qCqWsW8mWVgU7O+Db5aj2JbT4vi33xzuWmZif8ER2bjKc7FS0CjNYdF9dSvYaXiix+o8Go3oNkeVzWTgi9ovDi4iysO0FE3JXs4xUMUahOfquXb7e7ihJnKQXeYDJnOkAF87yGYuppZYEUYuxqkct1qS+3Vvu6z9qW/kiS62rALicdZH2vDqnU1PXAoasz+3tOGZqDE5xswSgiParpaRGWjMFAucspxL9n7KX0E3aPyJHwkN1gzzRoNmIUH7EeIrQ8M7oRFFRNL/HeQxOzpSnSnqzkQg+EsXVqqXF38BnCqSpxxmIPHwbXiAXpB5lkICbxpd+l+IYbgwA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1szawc-0001kr-N0 for bug-gnu-emacs@gnu.org; Sat, 12 Oct 2024 08:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 12 Oct 2024 12:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73600 X-GNU-PR-Package: emacs Original-Received: via spool by 73600-submit@debbugs.gnu.org id=B73600.17287349996681 (code B ref 73600); Sat, 12 Oct 2024 12:10:02 +0000 Original-Received: (at 73600) by debbugs.gnu.org; 12 Oct 2024 12:09:59 +0000 Original-Received: from localhost ([127.0.0.1]:40396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szawY-0001jZ-Nh for submit@debbugs.gnu.org; Sat, 12 Oct 2024 08:09:59 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:39504) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1szawU-0001ic-At for 73600@debbugs.gnu.org; Sat, 12 Oct 2024 08:09:54 -0400 Original-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 1szanD-0000x6-Rf; Sat, 12 Oct 2024 08:00:19 -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=GvfilIx2Os7GA1wHC1NMZ9TC5McZk7wZNiG+cZ0C+2M=; b=psuG4jHw/rzk /d1QrRNunu2u9kTPV1O4gOblJ8oa+QgW4jU2NfGiEXY14O+ITGSDdwvNDNsZBbDH0WuFCMPkkwPHO P40S8vZX3wQhCpxxlFFf/RXYLypaNDRTsibX8NilaPJvEZdPup08AeSqJMJ9tsrHhm5zFwNC4u4QE hLGPgi/lvG9U//XHz+A7rWVKFXtlrkIDNk5ywlBRfMgttlPk1MdaP696XpCPgBq5Ae2ElaFvrRZgA ZNyGm4U0mdLCk3YMgbZA9pJSzFlne+OnE608WycSHIafsGahrEOXs+bWAVBIhNbnPjXPwZ+e/JifT k+/XNJ3XsFQ/bqwaBQ8Kyw==; In-Reply-To: (message from Jim Porter on Sat, 5 Oct 2024 11:07:39 -0700) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:293424 Archived-At: > Date: Sat, 5 Oct 2024 11:07:39 -0700 > Cc: 73600@debbugs.gnu.org, gautier@gautierponsinet.xyz > From: Jim Porter > > >> - (when-let ((first-line-prefix (fill-match-adaptive-prefix)) > >> + (when-let ((eol (pos-eol)) > >> + ;; Don't add wrapping properties if we're in the middle > >> + ;; of an unsafe multi-line display spec. (For example, > >> + ;; this could be an image containing a newline-byte being > >> + ;; displayed in `image-mode'; see bug#73600.) > >> + ((visual-wrap--display-property-safe-p (point) -1)) > >> + ((visual-wrap--display-property-safe-p eol 1)) > >> + (first-line-prefix (fill-match-adaptive-prefix)) > > > > I'm not sure I can reason about this logic. I'd prefer the code to > > completely skip text covered by "unsafe" display properties, because > > reasoning about that text makes no sense: it will not show on display. > > Specifically, for the "text" that is the bytes of the image file, I > > don't know how to begin reasoning about newlines embedded in those > > bytes. Thus, it is hard for me to tell if I agree with the above > > logic or not. > > The idea here is this: > > 1. If we have some display property that spans multiple lines (either > from the previous line onto our current line, or from the current > line onto the next), then we need to be careful and check the specs > of this multi-line display property. > > a. If the multi-line display prop is something safe (e.g. 'raise'), we > can proceed with adding our visual-wrap props. > > b. Otherwise, we can't safely add visual-wrap props, so we bail out. > > 2. If no display property spans multiple lines, then any display props > on our line are *only* on our line, so we can add the visual-wrap > props without breaking the 'eq'-ness of any existing display props. > That's there to allow the behavior as shown in "image.html". > > For the image-mode case, if we have one newline-byte, then we hit > condition (1): we have the same display property on both the first and > second lines. Then we examine each display spec, and find that there's > one that's not on the safe list (b), so we bail out. > > I agree that this logic is fairly complex, and I'm happy to rearrange it > or add comments as needed once we're on the same page. I'm also ok with > just saying "any multi-line display properties are assumed to be unsafe" > for now. That's simpler, and we could add this extra logic later if > someone notices a specific issue. I'd prefer if we had code that, when it detects an unsafe display property, would completely skip all of it. With the above code, I fond it difficult to reason whether it sometimes considers newlines inside unsafe properties.