unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Eli Zaretskii <eliz@gnu.org>, Lars Ingebrigtsen <larsi@gnus.org>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "carlosjosepita@gmail.com" <carlosjosepita@gmail.com>,
	"18793@debbugs.gnu.org" <18793@debbugs.gnu.org>
Subject: bug#18793: 24.4; zero width rectangular selection displaces text
Date: Thu, 5 May 2022 17:51:16 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488FCE1D82289DCA52208A4F3C29@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <837d702b1w.fsf@gnu.org>

> > > 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	other threads:[~2022-05-05 17:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-22 14:32 bug#18793: 24.4; zero width rectangular selection displaces text Carlos Pita
2014-10-22 17:29 ` Stefan Monnier
2014-10-22 17:42   ` Eli Zaretskii
2014-10-23  0:55     ` Stefan Monnier
2022-05-05 13:16 ` Lars Ingebrigtsen
2022-05-05 16:34   ` Eli Zaretskii
2022-05-05 17:51     ` Drew Adams [this message]
2022-05-06 10:26     ` Lars Ingebrigtsen
2022-05-06 10:47       ` Eli Zaretskii
2022-05-06 11:05         ` Lars Ingebrigtsen
2022-05-06 11:06           ` Lars Ingebrigtsen
2022-05-06 11:19           ` Eli Zaretskii
2022-05-06 11:33             ` Lars Ingebrigtsen
2022-05-06 11:44               ` Eli Zaretskii
2022-05-06 12:52                 ` Lars Ingebrigtsen
2022-05-06 13:50                   ` Eli Zaretskii
2022-05-07 10:11                     ` Lars Ingebrigtsen
2022-05-07 10:18                       ` Lars Ingebrigtsen
2022-05-07 10:28                         ` Eli Zaretskii
2022-05-07 10:27                       ` Eli Zaretskii
2022-05-06 14:50                 ` Drew Adams
2022-06-02 19:19                   ` Rudolf Adamkovič via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-06-03  0:30                     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB5488FCE1D82289DCA52208A4F3C29@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=18793@debbugs.gnu.org \
    --cc=carlosjosepita@gmail.com \
    --cc=eliz@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).