all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* xterm-mouse-mode gives incorrect posn-object-x-y with display space
@ 2022-11-24 17:22 JD Smith
  2022-11-24 18:09 ` Stefan Monnier
  2022-11-24 18:34 ` Eli Zaretskii
  0 siblings, 2 replies; 10+ messages in thread
From: JD Smith @ 2022-11-24 17:22 UTC (permalink / raw)
  To: emacs-devel

The mouse-down events delivered by xterm-mouse-mode do not appear to handle clicks on entities with specified space display widths correctly.  Try this in a graphical window, and again in the terminal, with xterm-mouse-mode enabled:

(defun my/report-mouse (ev)
  (interactive "e")
  (let* ((posn (event-start ev))
	 (rel (posn-object-x-y posn)))
    (message "Got Relative Position %S" rel)))

(insert "\n\n  ----  "
        (propertize " "
                    'extend nil
                    'display '(space :width (48))
                    'keymap '(keymap (down-mouse-1 . my/report-mouse))
                    'font-lock-face 'underline)
        "  ----  ")

Mouse 1 click positions relative to the extended-width space (underlined for visibility) are reported correctly in graphical emacs, in screen pixel units.  With xterm-mouse-mode, however, relative positions are always reported as (0 . 0) for me, no matter where you click.  Is something wrong with my assumption that posn-object-x-y should work similarly in graphical as well as terminal emacs with xterm-mouse-mode (modulo the larger “pixel” size)?


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-11-27  1:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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

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.