GNU bug report logs - #31240
mouse commands not aware of rectangle regions

Previous Next

Package: emacs;

Reported by: charles <at> aurox.ch (Charles A. Roelli)

Date: Sun, 22 Apr 2018 18:35:02 UTC

Severity: normal

Found in version 26.1

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

Full log


Message #127 received at 31240 <at> debbugs.gnu.org (full text, mbox):

From: Federico Tedin <federicotedin <at> gmail.com>
To: rudalics <at> gmx.at
Cc: 31240 <at> debbugs.gnu.org, homeros.misasa <at> gmail.com, tkk <at> misasa.okayama-u.ac.jp,
 charles <at> aurox.ch
Subject: Re: bug#31240: 26.1; mouse-save-then-kill does not kill rectangles
Date: Fri, 12 Oct 2018 19:08:50 -0300
> If I now drag it up by one line and four columns to the right (so that
> it just does not intersect with itself) I get
>
> ;;;;;;;;;;RECT;;;;;;;;;
> ;;;;;;RECT;;;;;;;;;
> ;;;;;;RECT;;;;;;;;;
> ;;;;;;RECT;;;;;;;;;
> ;;;;;;RECT;;;;;;;;;
> ;;;;;;;;;;;;;;;
> ;;;;;;;;;;;;;;;;;;;
>
> which is somehow counterintuitive.  Any ideas?

This is because after inserting the rectangle, the original rectangle
(which is to the left of the inserted one) is deleted. When it is
deleted, then the last 4 lines of the inserted rectangle are shifted
to the left:

1) Inserted new rectangle:

;;;;;;;;;;RECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECT;;;;;;;;;
;;;;;;;;;;;;;;;;;;;

2) Deleted the original one:

;;;;;;;;;;RECT;;;;;;;;;  <--- this line isn't shifted
;;;;;;RECT;;;;;;;;;
;;;;;;RECT;;;;;;;;;
;;;;;;RECT;;;;;;;;;
;;;;;;RECT;;;;;;;;;
;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;

I've thought up two ways of dealing with this problem:

A) Forbid the user from dragging the rectangle to the right when the
new rectangle is *not* completly above or completly below the original
one. As an exception, allow the user to drag the rectangle purely to
the right (same line). In this option, the drag operation in your
example would not be permitted.  I think this option would be a bit
confusing for users (and too restrictive).

B) Add a variable mouse-drag-and-drop-rectangle-fill, initially set to
nil. When the variable's value is nil, the behaviour of dragging and
dropping rectangles is exactly the same as it is now. When it is set
to a non-nil value (for example, " "), then replace all characters of
the original rectangle with the variable's value. In this case, your
example would look like this:

1) M-: (setq mouse-drag-and-drop-rectangle-fill " ")

2) Inserted new rectangle:

;;;;;;;;;;RECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECTRECT;;;;;;;;;
;;;;;;RECT;;;;;;;;;
;;;;;;;;;;;;;;;;;;;

3) Deleted the original one:

;;;;;;;;;;RECT;;;;;;;;;
;;;;;;    RECT;;;;;;;;;
;;;;;;    RECT;;;;;;;;;
;;;;;;    RECT;;;;;;;;;
;;;;;;    RECT;;;;;;;;;
;;;;;;    ;;;;;;;;;
;;;;;;;;;;;;;;;;;;;

I can't think of any other way of ensuring the inserted rectangle
retains its shape after being inserted, if there are pending delete
operations to its left.




This bug report was last modified 6 years and 219 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.