From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#56393: Actually fix the long lines display bug Date: Sat, 09 Jul 2022 08:24:38 +0000 Message-ID: References: <38c1a31040d2d2bc47ae@heytings.org> <38c1a310405bd4bbe370@heytings.org> <87a69n98yy.fsf@yahoo.com> <38c1a31040f5546dbd3a@heytings.org> <83a69n90t8.fsf@gnu.org> <38c1a31040ad21b41adc@heytings.org> <835ykb8x3z.fsf@gnu.org> <38c1a310403dbabc7270@heytings.org> <834jzv8sv4.fsf@gnu.org> <38c1a31040ba2976eb4d@heytings.org> <83y1x77c2w.fsf@gnu.org> <87k08rkvgb.fsf@gnus.org> <38c1a31040e94458bd3d@heytings.org> <83o7y277b8.fsf@gnu.org> <762d224809bcab0d6bbc@heytings.org> <83fsje74pz.fsf@gnu.org> <762d224809bc038d2030@heytings.org> <838rp672p7.fsf@gnu.org> <762d224809114fbaf4af@heytings.org> <834jzu6wnu.fsf@gnu.org> <762d224809c7a439895e@heytings.org> <83wncq5dvu.fsf@gnu.org> <3ffab1919622ce555e12@heytings.org> <83ilo95uz8.fsf@gnu.org> <3ffab19196bc0451adb6@heytings.org> <83edyx5j2u.fsf@gnu.org> <83tu7q3iz5.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14298"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gerd =?UTF-8?Q?M=C3=B6llmann?= , larsi@gnus.org, 56393@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 09 10:25:30 2022 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 1oA5mK-0003XA-Mm for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 10:25:28 +0200 Original-Received: from localhost ([::1]:46830 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oA5mJ-0002mH-CY for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 09 Jul 2022 04:25:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44654) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oA5lu-0002lv-89 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 04:25:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:39792) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oA5lt-0000Dz-Tz for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 04:25:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oA5lt-000641-N7 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2022 04:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Jul 2022 08:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56393 X-GNU-PR-Package: emacs Original-Received: via spool by 56393-submit@debbugs.gnu.org id=B56393.165735508223277 (code B ref 56393); Sat, 09 Jul 2022 08:25:01 +0000 Original-Received: (at 56393) by debbugs.gnu.org; 9 Jul 2022 08:24:42 +0000 Original-Received: from localhost ([127.0.0.1]:33689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oA5la-00063M-0m for submit@debbugs.gnu.org; Sat, 09 Jul 2022 04:24:42 -0400 Original-Received: from heytings.org ([95.142.160.155]:58862) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oA5lY-00063C-EQ for 56393@debbugs.gnu.org; Sat, 09 Jul 2022 04:24:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1657355079; bh=hGf/b2ED3wtgrUWaCU5XHPl1NoV2wpbqxTqFBO6Tg4g=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=OtLydW04Rcaf6zZVihE5ld2kh4bT3qa4tLo78wTiH8pKynA1vBUsqO0EmmKtLsYpT uUO8PfSiwCAy3SMfNpEmCnfNPDac3E2LJ87LuDG2HN3RVl9qMgyf+Sym/CwZF0Wwey F7fI4xkgYI7IXwJ8iCnWCdayf+vgvlgPV0rHeUJ74W3vDeDt6WGW7ZbyW95ub8G3AK maNpBoC77eZm77I7eSEYIIu+q7GIPxJ+9R4m+xNKmo9oaKN6VfzqixbeESUJ1d3mlv R9xvlMMCrpj8cD9az92VSHK/lZXftyhXEesFe5pFbePcpf0rqC44nNuBL6KjWLCKG6 xMCiUNicjUhRg== In-Reply-To: <83tu7q3iz5.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:236482 Archived-At: > > I see that you decided to produce the "restriction" in init_iterator, > which would, of course, work, but IMO it has a disadvantage: > init_iterator is called a lot, so computing the "restriction" in it > should be very fast. Your current implementation _is_ fast, but AFAIU > its result is that we _always_ restrict the display code from seeing the > entire buffer, even if there are no long lines in it, which I think is > unnecessary. The original implementation only did that when it detected > a long line, and I think we should keep it that way, because the > "restriction" will inevitably have some negative effects, however minor, > on what we display. > I don't think we can detect long lines reliably enough. The problem of the original implementation is what Gerd mentioned: "What happens when evaluating an expression in *scratch* that returns a really large result? Or maybe in a Shell buffer some large output?" and similar cases, like inserting the result of a shell command in the buffer. Detecting long lines in insert-file-contents is not enough to make sure that Emacs will always continue to behave normally when a long line is on display. Note that we the current implementation does not always restrict display code from seeing the entire buffer, it does so in a few well-chosen places, everywhere else the display code sees the entire buffer. > > My proposal is to calculate the "restriction" in start_display. That > function is called by all the commands/functions that use the display > code outside of redisplay proper. (I think one or two such places call > init_iterator directly, but we can either handle them specially or > change them to use start_display.) In addition, to prevent even > start_display doing more than necessary, redisplay_window should compute > the restriction for the window that is about to be redisplayed, and > store the values in 'struct window'; then init_iterator, if called > inside redisplay, will then simply reuse those values, and start_display > will refrain from computing them anew. (To know whether some code is > invoked by redisplay, test the value of the global variable > redisplaying_p.) This way, we could make the "restriction" smarter, and > only apply it when needed. Another advantage is that this way the > "restriction" will be the same for all the code that is called by > redisplay_window, directly or indirectly, which I think is safer than > having different "restrictions" computed by different functions. > Okay, thanks. I'll try to do that.