emacs-devel
[Top][All Lists]
Advanced

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

Re: Moving point after character when clicking latter half of it


From: Eli Zaretskii
Subject: Re: Moving point after character when clicking latter half of it
Date: Sun, 09 Jul 2023 09:35:42 +0300

> From: Moritz Maxeiner <mm@ucw.sh>
> Date: Sat, 08 Jul 2023 23:01:12 +0200
> 
> I am using emacs gtk gui alongside other graphical text editors (left to 
> right text only).
> 
> In all of the ones I'm using (other than emacs), clicking with the mouse
> on a character moves the point either in front of, or after that character,
> depending on whether you clicked the left or right half of it.
> 
> In emacs, however, point seems to always be moved in front of the clicked 
> character,
> regardless of where on it you click. It would be great if emacs could 
> (optionally) also
> support the before/after behavior described above.
> 
> After delving into the code, it seems that this would need changes in C.
> I have attached a proof of concept patch that changes emacs' behavior,
> but it lacks an option mechanism. I also am not familiar enough
> with what unintended consequences this change may have.

Thanks, but the place where you suggest to make the change is not the
correct one.  The function move_it_in_display_line_to is the workhorse
of "display emulation", and is used by any code which needs to perform
calculations related to display layout without producing anything on
the glass.  It is fundamentally wrong to modify how all of that code
finds the position corresponding to a certain X coordinate just
because the user wants a mouse click to move point to the next
character.

The right place is in buffer_posn_from_coords.  The change will be
more complex there, but there's no way around this, since we want this
change to affect only mouse clicks.

> I am looking for feedback of whether this feature in general is something
> that would be acceptable to have in emacs and if there are any pitfalls
> this change may cause that I need to be aware of.

I think this will be acceptable as optional behavior, yes.  But we
need to consider all of its implications, such as what should happen
when the use drags the mouse -- do we also want the drag to affect
only the following character if the initial click is half-way across a
character's glyph?



reply via email to

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