all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: emacs-devel@gnu.org
Subject: Re: `C-b' is backward-char, `left' is left-char - why?
Date: Tue, 07 Jun 2011 10:51:13 +0200	[thread overview]
Message-ID: <874o42yqgu.fsf@fencepost.gnu.org> (raw)
In-Reply-To: 83lixgccd7.fsf@gnu.org

Eli Zaretskii <eliz@gnu.org> writes:

>> From: David Kastrup <dak@gnu.org>
>> Date: Sun, 05 Jun 2011 20:26:01 +0200
>> 
>> > The problems with this are not logical, they are with implementing it
>> > (both the movement itself and the resulting selection and highlight).
>> > Patches are welcome.
>> 
>> The resulting selection and highlight appear to do just what is needed
>> already and don't seem to have a problem with visual discontinuity.
>> 
>> So only the movement itself would appear to be an issue.
>
> Only if you accept the way the region is currently highlighted, as
> several disjoint stretches of text.  People who want strict visual
> operations might want something else, like contiguous regions.
>
>> If one has text like
>> 
>> llllllllRRRRRRRRllllll
>
> That's the easy use case.  Try figuring out the more complicated ones
> with embeddings and directional overrides.  UAX#9 allows up to 62
> levels of nested embeddings, with or without directional overrides,
> and Emacs supports them all.  Logical movement through that is clear,
> but visual one... last time I tried my mind boiled.

[...]

>> Actually, I've just tried entering mixed L2R and R2L stuff with the
>> keyboard and bidi-display-reordering set, and I find it quite
>> distracting that the insertion point for "reversed" text (with regard to
>> the current paragraph direction) gets increasingly distant from the
>> cursor itself.
>
> <Shrug> I just did the minimal change in the original redisplay
> design, whereby the cursor is placed on the character _after_ the
> insertion point in the logical order.  Even that required a total
> rewrite of the function that figures out where to draw the cursor.
> Patches are welcome to rewrite it again so as to keep the cursor
> closer to the insertion point.

I have thought about it, and I guess the key point is ambiguity of
cursor display.  The cursor is usually displayed just after the last
inserted character.  Which means to the left in R2L contexts, and to the
right in L2R contexts.  For a vertical cursor between characters, this
means that

LLLL^RRRR

is ambiguous: we are either at the end of the LLLL passage, or at the
end of the RRRR passage.  For a block or underline cursor, the ambiguity
gets worse:

LLL£RRRR

can mean that the cursor is next before last in the L2R passage, or last
in the R2L passage.

I think what is needed in this particular case is a virtual fill
character (perhaps the direction switch glyph, but displayed with a
different face?) at the insertion point when we are inserting in reverse
paragraph direction and the cursor would be displayed on a forward
paragraph character (including newline), not logically adjacent to the
insertion point.  Either that, or generally switch cursor type for
reverse direction insertion, so that one knows whether one has an L2R or
R2L facing cursor.

> Actually, TRT would be to split the cursor in two, because it plays
> two different roles whose correct positions in this case do not
> coincide.

They diverge only on borders between L2R and R2L, and a virtual padding
like described above gives the cursor a buffer that allows it to never
split.

> That would need an even deeper surgery, including in terminal-specific
> parts -- xterm.c, w32term.c, etc.  And what to do on a TTY with its
> hardware cursor?

The virtual padding approach should work on a tty since it requires only
one cursor to display.

-- 
David Kastrup




  reply	other threads:[~2011-06-07  8:51 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-27 20:40 `C-b' is backward-char, `left' is left-char - why? Drew Adams
2011-05-27 20:48 ` Pascal J. Bourguignon
2011-05-27 21:11   ` Eli Zaretskii
2011-05-27 22:08   ` Drew Adams
2011-05-28  0:19   ` Nix
2011-05-27 21:09 ` Eli Zaretskii
2011-05-27 21:13   ` Eli Zaretskii
2011-05-27 22:08   ` Drew Adams
2011-05-27 22:23     ` Antoine Levitt
2011-05-27 23:19       ` Drew Adams
2011-05-28  0:46         ` Mohsen BANAN
2011-05-28  1:53           ` Drew Adams
2011-05-28  2:24             ` Mohsen BANAN
2011-05-28  8:00         ` Eli Zaretskii
2011-05-27 23:09     ` PJ Weisberg
2011-05-27 23:23       ` Drew Adams
2011-05-28  0:25         ` PJ Weisberg
2011-05-28  0:39           ` Drew Adams
2011-05-28  6:57             ` David Kastrup
2011-05-28  8:21     ` Eli Zaretskii
2011-05-28  0:48 ` Stefan Monnier
2011-05-28  1:54   ` Drew Adams
2011-05-28  7:07     ` David Kastrup
2011-05-28  8:26     ` Eli Zaretskii
2011-05-30  3:57     ` Stefan Monnier
2011-05-31 14:18       ` Davis Herring
2011-05-31 14:39         ` Eli Zaretskii
2011-06-01 11:48         ` Andy Moreton
2011-06-01 13:23           ` Eli Zaretskii
2011-06-01 23:26             ` Andy Moreton
2011-06-02  4:37               ` Eli Zaretskii
2011-06-02 10:38                 ` Andy Moreton
2011-06-02 11:12                   ` Eli Zaretskii
2011-06-02 12:59                     ` Andy Moreton
2011-06-02 15:09                       ` Eli Zaretskii
2011-06-02 16:23                         ` Andy Moreton
2011-06-02 17:43                           ` Eli Zaretskii
2011-06-02 21:42                             ` Andy Moreton
2011-06-03  7:01                               ` Eli Zaretskii
2011-06-02 17:09                         ` David Kastrup
2011-06-02 18:05                           ` Eli Zaretskii
2011-06-03 14:35                             ` David Kastrup
2011-06-03 15:08                               ` Eli Zaretskii
2011-06-03 15:14                                 ` David Kastrup
2011-06-03 16:48                                   ` Eli Zaretskii
2011-06-03 20:56                                     ` David Kastrup
2011-06-04  6:28                                       ` Eli Zaretskii
2011-06-05 16:51                                 ` Ehud Karni
2011-06-05 17:10                                   ` Eli Zaretskii
2011-06-05 17:19                                     ` Ehud Karni
2011-06-05 17:26                                       ` David Kastrup
2011-06-05 17:44                                         ` Eli Zaretskii
2011-06-05 18:26                                           ` David Kastrup
2011-06-05 19:22                                             ` Eli Zaretskii
2011-06-07  8:51                                               ` David Kastrup [this message]
2011-06-07 10:54                                                 ` Eli Zaretskii
2011-06-02 15:35                       ` PJ Weisberg
2011-06-02 17:44                         ` Eli Zaretskii
2011-06-02 19:29                           ` PJ Weisberg
2011-06-02 21:10                             ` Eli Zaretskii
2011-06-03  0:47                   ` Kenichi Handa
2011-06-03  7:13                     ` Eli Zaretskii
2011-06-05 11:27                       ` Kenichi Handa
2011-06-05 13:04                         ` Eli Zaretskii
2011-06-02  7:23             ` David Kastrup
2011-06-02  8:59               ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=874o42yqgu.fsf@fencepost.gnu.org \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.