From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: xterm-mouse-mode gives incorrect posn-object-x-y with display space Date: Sat, 26 Nov 2022 20:14:31 -0500 Message-ID: <0D65D6CE-E51F-43CD-A93C-35A74F11F2C3@gmail.com> References: <835yf4w6a7.fsf@gnu.org> <5BBC7E49-41C3-4693-95F6-26E8EAC7F7A4@gmail.com> <837czhudev.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_DD612037-3000-45B0-A4A9-A96EB38019A8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36757"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 27 02:15:36 2022 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 1oz6Gb-0009LB-Pt for ged-emacs-devel@m.gmane-mx.org; Sun, 27 Nov 2022 02:15:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oz6Fl-0001OO-0C; Sat, 26 Nov 2022 20:14:41 -0500 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 1oz6Fj-0001OB-Gk for emacs-devel@gnu.org; Sat, 26 Nov 2022 20:14:39 -0500 Original-Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oz6Fh-00039h-3V; Sat, 26 Nov 2022 20:14:38 -0500 Original-Received: by mail-qv1-xf34.google.com with SMTP id r15so4640093qvm.6; Sat, 26 Nov 2022 17:14:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=VrGBvCBD2g8QJFJOonQURCDEmVn978LiBxudJJXM//Y=; b=RtE6IKWHZMXiH2Pcz3RhY/w5JjBXOc48711SHpybpZgXZY5+YhLR6a4UQCh7tqBvap j6VEUmLu3aWh/Ute2oTM92MqbIrOC1Pcnn+rtv832uEsNZilsRTO9i52gouDylHXY2te VkWbK/4iM7kqvYkBF7stpC/5mVlRfsERraItpSpUaOh8LaA6ykP+Bg4SCp4xwJojbTdD ZrpPCFwdc3LfBxO/YQ6roIUR2KJ2d1l9e57KgQWWu3174tDKOM8YKybcc7+QxriR5wBK H+mFZfUL6NNPxWTAZ50Wd0KPb6Di+fJM5s+GdIIeMwvMBAuTvnjUQdCq9MmiFTlu4K1E hMXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=VrGBvCBD2g8QJFJOonQURCDEmVn978LiBxudJJXM//Y=; b=vMuOAKwERakJZC9RPuEq4ijNTeb+dI9J1JdM61TjpKLp6tfJ7eF5nu+ih4EU2R3eT0 CxFsMq5CW5eF/SYimo8cxfGoM8Gg1qPg5mK8TNTlsIbfg6187AE9tS64WEimRD4XIn8h JUAAJcKEeqGI/czxHL8oXt/grOKOs//nX1aXttIzGboRan4fhKRVvjoGp1cBE+uY6fGG kgZ/75hIq3S9v4W/BDuIfZ/dAEunICMRUix7ZxR83OE7snUs/OQ2B6j1INjuexp7lHV7 6CZ/GGGj6R11JI/2xKhIQO6jT4HBdlK5mp08sohDnMt4eOCgHmHC2Q+k/KuVNWnGjiph mQaQ== X-Gm-Message-State: ANoB5pmW8GYlM61XLJebvax//zKTwE9Q1NxktrwitW4l1kVeZ2Y2KqNI 7Z6yX9q8w95lYSIOepaSDn1DEXN+SiE= X-Google-Smtp-Source: AA0mqf4uXMD/dQ9shKYi7k7QSYV9e+qcIIePToTJ1MecTxGvk0Yq2nyIw0BBvaO4WH7y6duvpd/FoA== X-Received: by 2002:a0c:f0cd:0:b0:4bb:63c9:20d8 with SMTP id d13-20020a0cf0cd000000b004bb63c920d8mr23674469qvl.64.1669511674792; Sat, 26 Nov 2022 17:14:34 -0800 (PST) Original-Received: from smtpclient.apple (cm-24-53-184-207.buckeyecom.net. [24.53.184.207]) by smtp.gmail.com with ESMTPSA id u5-20020a05620a430500b006fc5a1d9cd4sm3277541qko.34.2022.11.26.17.14.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Nov 2022 17:14:33 -0800 (PST) In-Reply-To: <837czhudev.fsf@gnu.org> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::f34; envelope-from=jdtsmith@gmail.com; helo=mail-qv1-xf34.google.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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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:300606 Archived-At: --Apple-Mail=_DD612037-3000-45B0-A4A9-A96EB38019A8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Nov 26, 2022, at 7:07 AM, Eli Zaretskii wrote: >=20 > posn-object-x-y for a display/overlay string measure from the nearest = glyph > of the string character, not from the beginning of the string. Right. My design of three adjacent stretched characters works well (in = GUI anyway) by exploiting this.=20 > I don't understand what you mean by "surprisingly it looks pretty good = on > TTY without any special casing", if mouse clicks on TTY frames give = you this > problem. Are you saying that you only see this with xterm-mouse-mode, = but > not with some other mouse which works with Emacs TTY frames? I only mean it _looks_ good there: the slider moves, and reports the = scroll position well, just more granularly, and with no direct mouse = interaction possible (or so I thought). For mouse on TTY I=E2=80=99ve = only tried (and only have access to) xterm-mouse-mode; in fact wasn=E2=80=99= t even aware of it until a user opened an issue. =20 > Why challenging? On TTY frames, align-to always aligns to some = character > position, and the mouse clicks are reported in terms of character = positions > as well. =20 Not impossible, just more complicated, since there are a number of = alignment options, only some of which use align-to. For example you can = just replace mode-line-percent-position with the graphical scrollbar, or = the user can place the scrollbar at an arbitrary position in the = modeline. And calculating the left boundary in the GUI is complicated = by proportional fonts, images, and all sorts of things, so this would = require serious special casing for the TTY. It=E2=80=99s too bad = posn-point doesn=E2=80=99t work in the modeline.=20 > Why do you even need the fine details of the POSITION part of the > mouse-click events on TTY frames? I use the width of the scrollbar as an analog =E2=80=9Cfractional line = position=E2=80=9D area. The precise click scrolls with window to that = exact analogous location. In the TTY =E2=80=9Cprecise=E2=80=9D simply = means =E2=80=9Cwhich character=E2=80=9D, but in the GUI it=E2=80=99s = =E2=80=9Cwhich pixel=E2=80=9D. I don=E2=80=99t know how many people use = mouse in a TTY, so I may just prevent it from doing harm but otherwise = leave it disabled. Thanks for the suggestions. --Apple-Mail=_DD612037-3000-45B0-A4A9-A96EB38019A8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Nov 26, 2022, at 7:07 AM, Eli Zaretskii <eliz@gnu.org> = wrote:


posn-object-x-y for a display/overlay string measure = from the nearest glyph
of the string character, not from = the beginning of the string.

Right.  My design of three adjacent stretched = characters works well (in GUI anyway) by exploiting this. 

I don't understand what you mean by "surprisingly it looks = pretty good on
TTY without any special casing", if mouse clicks on TTY = frames give you this
problem.  Are you saying that you only see this with = xterm-mouse-mode, but
not with some other mouse which works with Emacs TTY = frames?

I = only mean it _looks_ good there: the slider moves, and reports the = scroll position well, just more granularly, and with no direct mouse = interaction possible (or so I thought).  For mouse on TTY I=E2=80=99v= e only tried (and only have access to) xterm-mouse-mode; in fact = wasn=E2=80=99t even aware of it until a user opened an issue. =  

Why challenging? =  On TTY frames, align-to always aligns to some character
position, and the mouse clicks are reported in terms of = character positions
as well.  

Not impossible, just = more complicated, since there are a number of alignment options, only = some of which use align-to.  For example you can just replace = mode-line-percent-position with the graphical scrollbar, or the user can = place the scrollbar at an arbitrary position in the modeline.  And = calculating the left boundary in the GUI is complicated by proportional = fonts, images, and all sorts of things, so this would require serious = special casing for the TTY.  It=E2=80=99s too bad posn-point = doesn=E2=80=99t work in the modeline. 

Why do you even need the = fine details of the POSITION part of the
mouse-click = events on TTY frames?

I = use the width of the scrollbar as an analog =E2=80=9Cfractional line = position=E2=80=9D area.  The precise click scrolls with window to = that exact analogous location.  In the TTY =E2=80=9Cprecise=E2=80=9D = simply means =E2=80=9Cwhich character=E2=80=9D, but in the GUI it=E2=80=99= s =E2=80=9Cwhich pixel=E2=80=9D.  I don=E2=80=99t know how many = people use mouse in a TTY, so I may just prevent it from doing harm but = otherwise leave it disabled.  Thanks for the suggestions.

= --Apple-Mail=_DD612037-3000-45B0-A4A9-A96EB38019A8--