From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: Moving point after character when clicking latter half of it Date: Tue, 11 Jul 2023 21:10:24 +0800 Message-ID: <87wmz6bnlr.fsf@yahoo.com> References: <2255158.iZASKD2KPV@silef> <3255279.aeNJFYEL58@silef> <83ttuc7x3k.fsf@gnu.org> <3431515.QJadu78ljV@anduin> <83r0pe7hru.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8752"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Moritz Maxeiner , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 11 15:11:40 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qJD9Y-00022A-3i for ged-emacs-devel@m.gmane-mx.org; Tue, 11 Jul 2023 15:11:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qJD8i-0008Rd-4j; Tue, 11 Jul 2023 09:10:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qJD8g-0008RU-JY for emacs-devel@gnu.org; Tue, 11 Jul 2023 09:10:46 -0400 Original-Received: from sonic307-56.consmr.mail.ne1.yahoo.com ([66.163.190.31]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qJD8e-0004Bo-G5 for emacs-devel@gnu.org; Tue, 11 Jul 2023 09:10:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1689081040; bh=+mrpVv+9xdfrcghy01868Dgd12uNzbYOfJuaVERvzCc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=jVofRDWYBRcmwJL8nghCi0HY/+0D5kKulx5zKBfWP5vw0XObi+RBL9gdoT4kh3pzWkfIGJcVtL6yI5ezNyjyjfpX0xzfovqaAHoqRAHG2hSvOCsjJ1kZbdoT15jXzuPzEgL43STaKSEDnPLbJyoP3md2q90LL5ygvwKWsxxInmh6Z0rSP4FBhZgKKNYW4oavBpUXnPDmsUbIUlZ4TVsLl32PQ6NCIxFxeppUlqDoCtsQAFOFkWBtpNeH7azNwOajq/NExW7Ty0Yg33+PDCrONailEEBz+t5ISUBQyL8kzxoZJw/4Zw8DS4rbonDeP2s9wTd9HrvPYOAuCC4uR7upxw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1689081040; bh=KXzRChU6MZ0bGvm1gEpTFweTXKk1m0NplqdXcYkC2GK=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=i0dE/oEkxbTQWBRNAQE/nnm5zIZEFmp4YB9Q2cGBerBoi7b3uMt1uEQ1veLy91gfUzc8GDyofpF26VtmZuPjV7U4NFRqC0SDUhRj9MBUnwZcoJWjq0GQLQR/cCodMIi38Thn25NpIOSVX+OT1xdinExigTHgCsHFBfji4G5HQXH6/x12JODRQ5GmcBugKm3eHmIrnviiu/B3Zt9Rf082lUEbWyQslgfoSB/y1ZkSZtNtlxsA7rlwDgOLG84tEHjf3Wkm8zCOVamHbmGCh9ub5XZ4RWMSybioeLmZrZCQPilJ6/kF2/S5sF7cKi67D31hEd4f5IY1VbiKTcWoA/nTOQ== X-YMail-OSG: PDlVNQMVM1kKWCkMSh1koTrzeWappyk1qqILdGrGNbJZihvYZMVJN0had86UAQ9 W6rEwv31AEnB48RMnHJWYbJ9a3kYpHg20_15H6JAjTfCIwYoTo7Ne1v8X3kQpBiJTPnTojeSaGMC 2HPlAF5ahUlakg3s9s0WblP08PjTdMsFWPEyQyfqfPYf5whH5rkAc.EdXCcWxMGElkDJS3fRMktr LShTHc018ia7NqkQGCV.3gkAVpP_us_czwZsbBxXTZqV3N6fevVCtNCF2CCqe2cQ9alXWfefDasS u.iBwtOzqPD42ipy2.SBEPh6TN6j4u12.c9FBTsCHlflxbjcoo0i_HrZPlPBdK9IMku8g85e2plm 1xRSreByxCeAjmLUrdEa_jRUDWUWf2pOOPX9Kq7RzOktlqiFntdREdAEhOFU5OuI8.ITGSY912Od KM.87gwhPLLvKXJLGK7JyEvVxHQEsOgEwz6N19VS7E43LGVyNL_7zphgcgAzn8k.HGmx1ASVJY_r zMwrPM.VRSpyFQksxAFQOXm776GiDjTmSLsBYr2q9hLIxU5g3T1.qs8X1i6JCUXjoKCKixr5io7S 4CR6S5QgZ7z9WPWuAzueZMgsguJdqrrteXWzsG12RdQ54qlTcoWDNNojdbbTkucLdY1FH.aRmVeR 9SMT5JgkJWyUTeo2c55neWYV33hRO.0RYlWc45trDRWmUf4zsLqkYRp0lFbYDvj2h3VIHybkJKNb a0dTB1KZRc4g73B43XSyRsiF127.Bw9j8TuK08inaCmFBfIM9M_cnnslAKY.wYyPPhEAh79cG0ZB YbBFbSBz7oXaldTV58_z0ehKcWnaxly6U2Wrld3uU5 X-Sonic-MF: X-Sonic-ID: df1816d6-334b-4615-a2a6-98c344eea8d7 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic307.consmr.mail.ne1.yahoo.com with HTTP; Tue, 11 Jul 2023 13:10:40 +0000 Original-Received: by hermes--production-sg3-67fd64777-kvs8m (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 2234dc201fc5666df95bea1629e2168b; Tue, 11 Jul 2023 13:10:33 +0000 (UTC) In-Reply-To: <83r0pe7hru.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 11 Jul 2023 15:29:57 +0300") X-Mailer: WebService/1.1.21638 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.190.31; envelope-from=luangruo@yahoo.com; helo=sonic307-56.consmr.mail.ne1.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:307748 Archived-At: Eli Zaretskii 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.