emacs-devel
[Top][All Lists]
Advanced

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

Re: no good way to highlight rectangle while region is highlighted


From: Joe Wells
Subject: Re: no good way to highlight rectangle while region is highlighted
Date: Mon, 23 Jul 2007 23:52:53 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

Richard Stallman <address@hidden> writes:

>     I agree with you that it is low level.  At the same time, I think it
>     would make a far better user interface for highlighting the rectangle
>     I think the ease of the user seeing the rectangle would be much
>     better.
>
> I do not see why.  Could you explain?

I am assuming the goal of showing _both_ the rectangle and region
simultaneously.  (If you just want to show one of them at a time, then
background colors are more than enough.)

I think highlighting both the rectangle and the region will be easiest
by drawing colored lines around the rectangle and keeping the current
way of highlighting the region.  I have already tried this (using the
“box” feature with colored lines), and I find it the easiest to
visually understand of the ways that I have gotten to work.  I'm not
using it now because every time the rectangle changes, areas of text
get shifted on the screen right or left by 1 pixel and this is
visually jarring.  (This is using the “box” face feature with a
dimension of -1, which makes a line 1 pixel wide.  The text shifts
because the line takes up horizontal space (although no vertical space
is taken).)

In contrast, I think showing both region and rectangle with colors in
a way that is easy for the user to see will be more difficult.  Part
of the difficulty is due to the fact that part of the rectangle can be
outside of the region and part can be within.

(By the way, I would also like to see a solution that shows the
rectangle when it is of zero width.  That would be quite useful for
some rectangle commands.  None of the methods I have tried so far can
work for this case.)

>     I think it is worth pointing out (again) that the ?box? feature of
>     faces _already_ supports having the _horizontal_ lines take no extra
>     space.  It is a bit strange that it supports this but does not support
>     having the _vertical_ lines take no extra space.
>
> It does sound like a natural extension, but it might be hard to
> implement since it involves changing the display code.  (Do you want
> to implement this and debug it?)  And I still don't see how it relates.

It relates because it would solve the only problem I have encountered
with using the “box” feature of faces to highlight the rectangle.
That problem is that chunks of text get shifted left or right by a
pixel every time the rectangle changes.  Other than this problem,
using the “box” feature to highlight the rectangle works great and is
easy to understand.

(No, I'm not volunteering.  Sorry, maybe a year from now, not now.)

>     Using some of the code in sense-region.el,
>     I am now showing both the region and rectangle at once.
>
> Why do you want to?

Because in Emacs there are many commands that affect the region, and
there are also many commands that effect the rectangle, and at any
given moment I might want to use any of them (either region or
rectangle), so it would be useful to have visual indicators of what
portions of the text both kinds of commands would affect.

>     I think it is useful (and is the way Emacs has worked already for
>     decades) to have both rectangle and region commands available at all
>     times.  In this case, because Emacs doesn't know whether you are going
>     to use a region or rectangle command next, it is helpful to be able to
>     show them both.
>
> I would not want that as a normal feature.

As I explained above, it would be helpful, at least to me (and I
think to others as well).

> I think it would look confusing.

That depends on how smoothly it is implemented.  I think using the
“box” face feature for the rectangle and colors for the region would
make it easy for people to see which was which.

> I would rather have a command to switch between region and rectangle.

That could also be useful.

I hope these comments are helpful.

-- 
Joe




reply via email to

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