[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] master 134ba45: Allow two mouse functions to work with

From: Stefan Monnier
Subject: Re: [Emacs-diffs] master 134ba45: Allow two mouse functions to work with Rectangle Mark mode
Date: Sat, 20 Oct 2018 17:21:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> I thought you were actually referring to another problem. Consider the
> following example, where a buffer contains the text (spaces added for
> clarity):
>  a
>  b b
>  c c c
>  d d d d
> ...and the user selects the following rectangular region:
> [a      ]
> [b b    ]
> [c c c  ]
> [d d d d]
> In this case, the first overlay will actually only contain "a", so
> subtracting (current-column) in its end and start will yield 1. This
> makes sense, as evaluating (car (region-bounds)) yields (1 . 2).

Ah, right, that's yet another problem, indeed.

> Something I also realized is that the variables 'region-width' and
> 'region-height' are 1) rectangular region-specific

Sorry for not mentioning it earlier.

> and 2) are only used when checking if the region is being dragged into
> itself (setq drag-but-neglibible ...).

I don't understand enough of the "dragged into itself" test to know what
should be done here.  I think part of the issue is that for rectangular
regions, the "insert-for-yank" will actually not just insert, so we
can't just test "is insertion-point inside region-bounds?" (which could
be easily implemented in a generic way).  But at the same time, why
should we disallow dragging the rectangle to a place that overlaps its
original location?

> Maybe their definition could be moved to
> that specific part of the code (and only define them when the region
> is rectangular).

If that can be done, that sounds good.

> I believe the only parts of the code that is rectangle-specific are:
> 1) Checking if the drag is negligible
> 2) Inserting the text in the new position
> 3) Re-activating the region after a successful or failed drag

insert-for-yank takes care of (2), doesn't it?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]