Repository navigation
Measure mouse cells with the buffer's font metrics - #684
Merged
Merged
Conversation
posn-col-row divides by the frame's character size, which ignores buffer-local face remapping, so clicks and wheel events landed on the wrong cell under text-scale-mode, buffer-face-mode, or a theme that remaps the default face. Using posn-col-row with USE-WINDOW would drop line-spacing instead. Divide the event's pixel position by default-font-width and default-line-height of the event's window. Fixes #676
dakra
force-pushed
the
fix/mouse-posn-text-scale
branch
from
September 13, 2026 14:21
afcf1cb to
2dbae58
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #676.
The mouse handlers called
posn-col-rowwithout USE-WINDOW, which divides the event's pixel position by the frame's character size. That ignores buffer-local face remapping, so clicks, drags and wheel events forwarded to a TUI landed on the wrong cell undertext-scale-mode,buffer-face-mode, or a theme that remaps the default face.posn-col-rowwith USE-WINDOW is not a fix either: it useswindow-font-height, which dropsline-spacing, and ghostel sets that buffer-locally fromghostel-line-spacing.The new
ghostel--posn-celldividesposn-x-ybydefault-font-widthanddefault-line-heightof the event's window, with a frame-level posn resolving through the frame's selected window (drag motion can stray off any window). All five handlers use it.Verified in a GUI Emacs with a bash shell under ghostel and
text-scale-set 3: a click aimed at column 12, row 4 previously mapped to (23 . 7) and now maps to (12 . 4). An ERT test pins the buffer-metric math and the frame fallback.