unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Po Lu <luangruo@yahoo.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Moritz Maxeiner <mm@ucw.sh>,  emacs-devel@gnu.org
Subject: Re: Moving point after character when clicking latter half of it
Date: Tue, 11 Jul 2023 21:10:24 +0800	[thread overview]
Message-ID: <87wmz6bnlr.fsf@yahoo.com> (raw)
In-Reply-To: <83r0pe7hru.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 11 Jul 2023 15:29:57 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> I'm not sure this is TRT.  In particular, it sounds like the change
> you made in xterm.c also overrides the Y coordinate condition? that
> doesn't sound right to me.  Po Lu, WDYT about this?
>
> The other changes LGTM, thanks.

This part of the patch

>    if (frame != dpyinfo->last_mouse_glyph_frame
>        || event->x < r->x || event->x >= r->x + r->width
> -      || event->y < r->y || event->y >= r->y + r->height)
> +      || event->y < r->y || event->y >= r->y + r->height
> +      || mouse_click_prefer_closest_char && EQ (track_mouse, Qdrag_tracking))

appears to special case a value of `track_mouse', and unconditionally
report mouse movement upon such a value being set, without considering
if the mouse pointer has moved to a position within the glyph that could
lead to a new position being reported.  This is not only wrong (since
Emacs shouldn't report mouse events differently even if `track_mouse' is
some other non-nil value), but is also inefficient, as setting
mouse_moved unnecessarily will result in an excessive number of mouse
motion events being reported.

I don't think we should disable the optimizations here entirely;
instead, it should be just as effective to save only the half of the
glyph containing the mouse pointer inside `remember_mouse_glyph' when
`mouse_click_prefer_closest_char' is true.

> +  DEFVAR_BOOL ("mouse-click-prefer-closest-char", mouse_click_prefer_closest_char,
> +	       doc: /* Non-nil means mouse click prefers the closest glyph as point.
> +When this is non-nil, clicking inside a glyph picks up the next glyph if the click
> +is closer to it then half the width of the clicked glyph.  */);
> +  mouse_click_prefer_closest_char = false;

Since this affects much more than just mouse clicks, shouldn't the
variable be named something else?  How about naming the variable
`mouse-prefer-closest-glyph', and using the following doc string
instead:

  Non-nil means mouse position lists are reported relative to the glyph
  closest to their coordinates.

  When non-nil, mouse position lists will be reported with their
  `posn-point' set to the position of the glyph closest to the mouse
  pointer, instead of the glyph immediately under.

Also, shouldn't the Lisp reference manual mention this variable?  In
(elisp)Accessing Mouse, for example.



  reply	other threads:[~2023-07-11 13:10 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08 21:01 Moving point after character when clicking latter half of it Moritz Maxeiner
2023-07-09  6:35 ` Eli Zaretskii
2023-07-09 12:44   ` Moritz Maxeiner
2023-07-09 13:23     ` Eli Zaretskii
2023-07-09 13:51       ` Moritz Maxeiner
2023-07-09 14:14         ` Eli Zaretskii
2023-07-09 21:47           ` Moritz Maxeiner
2023-07-10 12:46             ` Eli Zaretskii
2023-07-10 14:43               ` [External] : " Drew Adams
2023-07-10 20:02               ` Moritz Maxeiner
2023-07-11 12:29                 ` Eli Zaretskii
2023-07-11 13:10                   ` Po Lu [this message]
2023-07-11 18:01                     ` Moritz Maxeiner
2023-07-12  0:52                       ` Po Lu
2023-07-12 19:58                         ` Moritz Maxeiner
2023-07-12 21:17                           ` Yuan Fu
2023-07-12 21:36                             ` Moritz Maxeiner
2023-07-12 22:08                               ` Yuan Fu
2023-07-13  5:27                             ` Eli Zaretskii
2023-07-13 23:25                               ` Yuan Fu
2023-07-13  0:31                           ` Po Lu
2023-07-13  8:47                           ` Eli Zaretskii
2023-07-21 19:04                             ` Moritz Maxeiner
2023-07-21 23:57                               ` Po Lu
2023-07-22  5:41                                 ` Eli Zaretskii
2023-07-22 10:07                                   ` Moritz Maxeiner
2023-07-22 11:31                                     ` Po Lu
2023-07-22 12:51                                     ` Eli Zaretskii
2023-07-22 15:28                                       ` Moritz Maxeiner
2023-07-22 15:51                                         ` Eli Zaretskii
2023-07-22 15:59                                           ` Moritz Maxeiner
2023-07-22 16:34                                             ` Eli Zaretskii
2023-07-22 19:10                                             ` Yuan Fu
2023-07-09 13:58       ` Yuri Khan
2023-07-09 12:40 ` Benjamin Riefenstahl
2023-07-09 12:47   ` Moritz Maxeiner
2023-07-09 13:37     ` Benjamin Riefenstahl
2023-07-09 15:15   ` [External] : " Drew Adams
2023-07-09 15:33     ` Moritz Maxeiner
2023-07-09 16:06       ` Drew Adams
2023-07-09 16:21       ` Brian Cully via Emacs development discussions.
2023-07-09 18:01         ` Jens Schmidt
2023-07-09 16:43       ` [External] : " Eli Zaretskii
2023-07-12 18:21     ` Benjamin Riefenstahl
2023-07-12 18:32       ` Eli Zaretskii
     [not found] ` <12248204.O9o76ZdvQC@anduin>
     [not found]   ` <87ilac2kla.fsf@yahoo.com>
2023-07-22 14:48     ` Moritz Maxeiner
2023-07-22 15:26       ` 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

  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=87wmz6bnlr.fsf@yahoo.com \
    --to=luangruo@yahoo.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mm@ucw.sh \
    /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).