[Top][All Lists]

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

Re: xterm-mouse-mode gives incorrect posn-object-x-y with display space

From: JD Smith
Subject: Re: xterm-mouse-mode gives incorrect posn-object-x-y with display space
Date: Sat, 26 Nov 2022 20:14:31 -0500

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.

reply via email to

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