bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#18793: 24.4; zero width rectangular selection displaces text


From: Drew Adams
Subject: bug#18793: 24.4; zero width rectangular selection displaces text
Date: Thu, 5 May 2022 17:51:16 +0000

> > > 1) Put the point at the beginning of the following sequence of a's.
> > > 2) Start a rectangular selection with C-x Space.
> > > 3) Move the point one char to the right.
> > > 4) Move it one char to the left so that it returns to the left
> margin.
> > > 5) Repeat 3 and 4 a number of times.
> > >
> > > aaaaaaaaaaa
> > >
> > > Do you see how the sequences of a's moves back and forward?
> >
> > I can confirm that this behaviour is still present in Emacs 29.
> 
> AFAIU, that's a feature: we are trying to indicate the existence of
> the selection, even though its width is zero.  Type "M-x
> describe-text-properties RET" at the first character.  The indication
> must take up some space on display, so it moves the following text to
> the right.

Some indication that the selection is active and
rectangular is needed - that's a good idea.

But this slight movement isn't the greatest way
to indicate this.  It's barely noticeable (but
it helps IMO, and is better than nothing).

We do also show a message when you turn on
Rectangle-Mark mode (with `C-x SPD').  That's OK.

But then when you move point to select more than
an empty selection the text moves back again
(reverse slight motion).

So this "jiggle" indicates change to and from an
empty selection, not whether rectangle mark mode
is on or off.  That's fine, but there's no msg
or other indication (apart from the jiggle) for
change to/from an empty rectangular selection.

I think we could do better.
___

Here's one possibility:

With minor mode `modeline-region-mode', from
`modeline-region.el', the region state is shown
in the mode-line whenever the region is active.

E.g., with point at the start of that line of
aaaaaaaaaaa, after using `C-x SPC' you see this in
the mode-line, highlighted with face `mlr-region'
(by default it looks the same as face `region'):

  1 rows, 0 cols

That is, in rectangle-mark mode, the size
indication shows the region size as the number of
rows and columns.

Following the OP recipe with this:

aaaaaaaaaaa

bbbbbbbbbbb

ccccccccccc

When the first column is selected across all rows,
you see this in the mode-line:

  7 rows, 1 cols

If you then use C-x SPC to turn off rectangle-mark
mode, the mode-line indication changes to this:

  7 lines, 40 chars

There are multiple ways to indicate the selection
status in the mode line.  Those 2 are the defaults.

The code is here:

https://www.emacswiki.org/emacs/download/modeline-region.el

Library description is here:

https://www.emacswiki.org/emacs/ModeLineRegion





reply via email to

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