]> git.eshelyaron.com Git - emacs.git/commit
Speed up tall rectangular selections (bug#72830)
authorMattias EngdegÄrd <mattiase@acm.org>
Thu, 29 Aug 2024 12:14:22 +0000 (14:14 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Sep 2024 10:45:18 +0000 (12:45 +0200)
commit874f4c09338ca2220eba2d2d1dd858b15a7a223a
treec5ca0766e84bbed8a6af26525ecabb22cb887067
parent5212bce287ddcf673b58d0e09623b78e9212685d
Speed up tall rectangular selections (bug#72830)

Instead of setting the highlight overlay on every line in the selection,
only do so on the window-height worth of lines closest to point because
the rest aren't likely to be visible.

This makes a massive difference for tall rectangular selections which
previously were so slow as to be unusable.

(Tall selections are still slow if `select-active-regions` is non-nil,
but that is something that users can actually do something about.)

* lisp/rect.el (rectangle--highlight-for-redisplay)
(rectangle--unhighlight-for-redisplay):
Replace call to `apply-on-rectangle`, which operates on every line,
with a loop over an approximate screenful.
Extend the `rectangle` overlay list structure with a value for point,
because `exchange-point-and-mark` must trigger a recomputation of
highlight overlays despite the selection not actually changing.

(cherry picked from commit 38c7516827902cdfb70bf68b2da4296a8d9349c0)
lisp/rect.el