all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: JD Smith <jdtsmith@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: xterm-mouse-mode gives incorrect posn-object-x-y with display space
Date: Sat, 26 Nov 2022 20:14:31 -0500	[thread overview]
Message-ID: <0D65D6CE-E51F-43CD-A93C-35A74F11F2C3@gmail.com> (raw)
In-Reply-To: <837czhudev.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2184 bytes --]



> 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’ve only tried (and only have access to) xterm-mouse-mode; in fact wasn’t 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’s too bad posn-point doesn’t 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 “fractional line position” area.  The precise click scrolls with window to that exact analogous location.  In the TTY “precise” simply means “which character”, but in the GUI it’s “which pixel”.  I don’t 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.


[-- Attachment #2: Type: text/html, Size: 5693 bytes --]

      parent reply	other threads:[~2022-11-27  1:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-24 17:22 xterm-mouse-mode gives incorrect posn-object-x-y with display space JD Smith
2022-11-24 18:09 ` Stefan Monnier
2022-11-24 18:34 ` Eli Zaretskii
2022-11-24 21:42   ` JD Smith
2022-11-25  7:21     ` Eli Zaretskii
2022-11-25 15:15       ` JD Smith
2022-11-26 12:07     ` Eli Zaretskii
2022-11-26 18:56       ` Akib Azmain Turja
2022-11-26 19:14         ` Eli Zaretskii
2022-11-27  1:14       ` JD Smith [this message]

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=0D65D6CE-E51F-43CD-A93C-35A74F11F2C3@gmail.com \
    --to=jdtsmith@gmail.com \
    --cc=eliz@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.