dbordak / telephone-line

A new implementation of Powerline for Emacs
GNU General Public License v3.0
560 stars 49 forks source link

Mouse clicks don't work consistently when `telephone-line-target` is `'header-line` on macOS:d12frosted/emacs-plus@30 #147

Open Cerebus opened 6 days ago

Cerebus commented 6 days ago

Mouse-1/3 on buffer-segment works, but pretty much nothing else does. project-segment, flymake-segment, and major-mode segment do nothing on mouse-1 and throw and error <header-line> <mouse-X> undefined for mouse-2 and mouse-3.

Since these segments are pulling in mode-line formats directly, it's not a string properties problem--and hovering brings up the tooltip as expected.

dbordak commented 6 days ago

Does it working/not working map to whether or not the supersegment is accented? accents have to be done by applying new properties, which might squash the mouse props.

Cerebus commented 6 days ago

My current RHS:

(setq telephone-line-rhs
   '((faded . (telephone-line-flymake-segment
           telephone-line-misc-info-segment
           telephone-line-major-mode-segment
           telephone-line-airline-position-segment))))

faded is defined as faces (nano-faded-i . nano-subtle). When I set the supersegment to nil (which still has the alist entry (mode-line . mode-line-inactive)), I get the same messages with mouse-2/3 on flymake and major-mode segments.

dbordak commented 6 days ago

I double-checked, sorry, I misremembered, even nil segments are propertized. However, I can't reproduce this (on emacs 30), mouse support works on e.g. telephone-major-mode-segment for me (I don't have a Mac to check your particular build, though). Did you check whether this exclusively affects header-line? (I'd assume it's unrelated, though, since buffer-segment works...)

dbordak commented 6 days ago

I apologize, sorry, for some reason I thought it was enough to check that in mode-line; I can confirm that mouse support doesn't work properly in the header-line. According to this SE post, it's because mode-line and header-line receive different mouse events https://emacs.stackexchange.com/questions/47211/local-map-in-header-line

Unsure of how to fix this, because I create mode-line maps with make-mode-line-mouse-map, but no equivalent for the header-line exists

Cerebus commented 6 days ago

On a quick spot check, the workaround in that SE answer seems to work for major-mode segment but not flymake. I'll poke around some more.

(define-key mode-line-major-mode-keymap [header-line]
            (lookup-key mode-line-major-mode-keymap [mode-line]))