Subject: Re: bug#31240: 26.1; mouse-save-then-kill does not kill rectangles

From: martin rudalics <[email-masked]>
Date: Sat, 06 Oct 2018 19:08:51 +0200

> The example Homeros tried to run won't work, because the newly intersected
 > rectangle would intersect the original rectangle. This behaviour is
 > intentional, as it
 > is similar to mouse-drag-and-drop-region's behaviour with non-rectangle regions.
 >
 > However, I think an exception could be made for rectangle operations move the
 > rectangle horizontally to the left, as Tak said. When the rectangle is
 > dragged to the left,
 > there's no way its content could be accidentally added to the overlays
 > tracking the original
 > rectangle, so it'll always work correctly (even if
 > rectangle-intersect-p returns t).

FWIW I see no problems with the following naive amendment

                            (let ((size (cons region-width region-height)))
                              (and (rectangle-intersect-p
                                    (rectangle-position-as-coordinates start) size
                                    (rectangle-position-as-coordinates point-to-paste) size)
                                   (not (= (line-number-at-pos start)
                                           (line-number-at-pos point-to-paste)))))

which also allows shifting the rectangle strictly to the left or
right.  IIUC it's the deletion of the original rectangle after the
copy was inserted on a different line that's causing havoc with
intersections.  But I have not tested all possible variants so please
correct me if I'm wrong.

martin