From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72830: Big rectangular selections are slow Date: Tue, 27 Aug 2024 15:44:44 -0400 Message-ID: References: Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11646"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: eliz@gnu.org, 72830@debbugs.gnu.org, juri@linkov.net To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 27 21:45:28 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 1sj287-0002n2-Nn for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 27 Aug 2024 21:45:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sj27r-0006m6-9h; Tue, 27 Aug 2024 15:45:11 -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 1sj27p-0006lh-HI for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2024 15:45:09 -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 1sj27o-0004se-VV for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2024 15:45:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=5+hDYKc1vwM1Phgqrcv6Wzdk7zx1Zf+n4q5Lllovudw=; b=NadnrJGuYVsVTA+FEGG4rUNmakfEuhEs5l77QE58OFkWNv8switd/FlFctRSdfBzlgQrAk+oBzaIYUjsN0y2BlT5h/3PM4xcVlAL9bhx2T2AopA7vXgYN/nMRGokAR2sAqsNjpnq3ljXormkvfscfK0UL2f0y53BF5iHpJ4qpKHO1J02wu+8w5/KCJZ+9u3VAZ5o9jU35Wz/3ahHnAVReBP5cRZm1Aoyf9BW9067bUlhiFCT52DvkFLNymUI62aB6H7TbTMSqVhsh144rYFQp+uB+Sx66eEUOUMAa0OBxUPYU5y/J4VnO83S+QYWokrdPRCvRt1HTPYCO9+KW2i06A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sj28f-00073x-Jx for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2024 15:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 27 Aug 2024 19:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72830 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: Eli Zaretskii , Emacs Bug Report , Juri Linkov Original-Received: via spool by submit@debbugs.gnu.org id=B.172478794927117 (code B ref -1); Tue, 27 Aug 2024 19:46:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 27 Aug 2024 19:45:49 +0000 Original-Received: from localhost ([127.0.0.1]:47625 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sj28S-00073I-Kw for submit@debbugs.gnu.org; Tue, 27 Aug 2024 15:45:49 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:59378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sj28Q-000737-A8 for submit@debbugs.gnu.org; Tue, 27 Aug 2024 15:45:48 -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 1sj27Y-0006h0-Pb for bug-gnu-emacs@gnu.org; Tue, 27 Aug 2024 15:44:53 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sj27W-0004g5-TY; Tue, 27 Aug 2024 15:44:52 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 546AD8092C; Tue, 27 Aug 2024 15:44:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1724787885; bh=Lr7uWtDPBHfzPAEnXXqKsyfGeghKqdn+LRFV49P+G90=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=cUR5beQGcvH0u+YymBJ5AHNjx2YdLRUhXo1oKjXjfoW81IdV8wF/y82OPNkXnFTti e/Vof/fA7KhXNdDISSgYdUlgJewZlgZqCaiDB42HSTZgX9S+fv2DP/AQ87bPjhZelt /Bcv6aZaO5ggnbP+gcrnKHr6Fb66QRWJPYkI5UijqFsY8o5xqNLKoxVQFRIOYwgOML AiOoV1CBmLJjF8hb8RcGcF5oRGK3KBHghO2rfHto4Trcwc1hhvcfWu0BR+GoWN+yWK w4tihzjAaBMRJfedx7PdxETYBVYxdBiTFtoZaX7Yp587xdhMuuqkYLRpIU6ZpxC4uv VCVrrblTV5y+A== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CAEEB8025B; Tue, 27 Aug 2024 15:44:45 -0400 (EDT) Original-Received: from asado (unknown [23.233.149.155]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id AB60F1202B1; Tue, 27 Aug 2024 15:44:45 -0400 (EDT) In-Reply-To: ("Mattias =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Tue, 27 Aug 2024 18:42:19 +0200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:290840 Archived-At: >>> - `select-active-regions` makes each selection change very expensive. >>> Can be set to nil by the user, but I really suggest that we change the >>> default to nil, at least for non-X11 since the default assumes old-scho= ol >>> X11 PRIMARY selection which is alien on most other platforms. >>=20 >> Didn't think of that. Do we re-set the PRIMARY every time the (active) >> rectangular region is changed (i.e. after each key press)? That would >> make it non-scalable to large rectangular regions, indeed. > > It's pretty bonkers, yes. There is even a noticeable slow-down with > a single contiguous selection. Fortunately the cure is easy. I rely on it on a regular basis, and I'm probably not the only one, so even if we disable it by default, we should make it work well enough for large rectangular regions. > But how do we know what the viewport will be in > `rectangle--highlight-for-redisplay`? Since it is redisplay that determin= es > window-start and window-end, and it hasn't run yet, this puts us in some > kind of chicken-egg situation. Maybe it has to be done inside redisplay. The code should use `window-start` and `window-end` for that. There might be some remaining issues with (re)running the `pre-redisplay-function(s)` when redisplay forces a change in `window-start` (or in the unlikely case where the highlighting moves the `window-end` further), but these are things we need to fix anyway. There are further issues when several windows display the buffer. =F0=9F= =99=82 We could also move some of the work to jit-lock, which would have the advantage that it would additionally be able to skip over (large) chunks that are marked as `invisible`. Stefan