Subject: bug#51111: 28.0.50; Wrong point position on mouse click when using line-height on scaled text

From: Umar Ahmad <[email-masked]>
Date: Sun, 10 Oct 2021 02:53:10 +0530

Actually, This only happens when I do a `setq-default`
Setting it only for a single buffer with a `setq-local` seems to not cause
the problem described above

On Sun, Oct 10, 2021 at 1:23 AM Umar Ahmad <[email-masked]> wrote:

>
> Mouse clicks on some text in an emacs window does not correctly position
> the point when the line-height is set to some value and the text is
> scaled to become larger
>
> Steps to reproduce with emacs -Q
> - Open a new buffer (C-x b *test-buffer RET)
> - Yank few lines of text from somewhere
> - Eval (M-:) the following:
>   `(setq-default default-text-properties '(line-height 1.1))`
> - Scale text to make it larger (C-x C-= = = =)
> - Click on any line to place the point at that location.
> - Point is placed few lines further below the click position
>
> - Reset the line-height to nil by evaluating:
>   `(setq-default default-text-properties '(line-height nil))`
> - Click on any line to place point at that location.
> - Point is placed correctly
>
>
>
> In GNU Emacs 28.0.50 (build 1, x86_64-apple-darwin20.5.0, NS
> appkit-2022.50 Version 11.4 (Build 20F71))
>  of 2021-07-31 built on Umars-MacBook-Pro.local
> Windowing system distributor 'Apple', version 10.3.2022
> System Description:  macOS 11.5.2
>
> Configured using:
>  'configure --disable-dependency-tracking --disable-silent-rules
>  --enable-locallisppath=/usr/local/share/emacs/site-lisp
>  --infodir=/usr/local/Cellar/emacs-plus@28/28.0.50/share/info/emacs
>  --prefix=/usr/local/Cellar/emacs-plus@28/28.0.50 --with-xml2
>  --with-gnutls --with-native-compilation --without-dbus
>  --with-imagemagick --with-modules --with-rsvg --with-xwidgets --with-ns
>  --disable-ns-self-contained 'CFLAGS=-I/usr/local/opt/gcc/include
>  -I/usr/local/opt/libgccjit/include -I/usr/local/opt/gmp/include
>  -I/usr/local/opt/jpeg/include' 'LDFLAGS=-L/usr/local/lib/gcc/11
>  -I/usr/local/opt/gcc/include -I/usr/local/opt/libgccjit/include
>  -I/usr/local/opt/gmp/include -I/usr/local/opt/jpeg/include''
>
> Configured features:
> ACL GIF GLIB GMP GNUTLS IMAGEMAGICK JPEG JSON LCMS2 LIBXML2 MODULES
> NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG THREADS TIFF
> TOOLKIT_SCROLL_BARS XIM XWIDGETS ZLIB
>
> Important settings:
>   value of $LC_ALL: en_US.UTF-8
>   value of $LANG: en_US.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: ELisp/d
>
> Minor modes in effect:
>   flyspell-lazy-mode: t
>   winner-mode: t
>   global-git-commit-mode: t
>   shell-dirtrack-mode: t
>   org-roam-db-autosync-mode: t
>   auto-insert-mode: t
>   org-wild-notifier-mode: t
>   pdf-occur-global-minor-mode: t
>   dap-tooltip-mode: t
>   dap-ui-many-windows-mode: t
>   dap-ui-controls-mode: t
>   dap-ui-mode: t
>   treemacs-filewatch-mode: t
>   treemacs-follow-mode: t
>   treemacs-git-mode: t
>   treemacs-fringe-indicator-mode: t
>   dap-auto-configure-mode: t
>   dap-mode: t
>   yas-global-mode: t
>   yas-minor-mode: t
>   ws-butler-mode: t
>   whitespace-mode: t
>   global-gumshoe-mode: t
>   mini-frame-mode: t
>   which-key-mode: t
>   selected-global-mode: t
>   selected-minor-mode: t
>   smartparens-global-mode: t
>   smartparens-mode: t
>   global-undo-tree-mode: t
>   undo-tree-mode: t
>   global-so-long-mode: t
>   all-the-icons-ivy-rich-mode: t
>   ivy-rich-mode: t
>   projectile-mode: t
>   ivy-mode: t
>   save-place-mode: t
>   git-gutter-mode: t
>   global-auto-revert-mode: t
>   eros-mode: t
>   display-line-numbers-mode: t
>   hl-line-mode: t
>   highlight-numbers-mode: t
>   show-paren-mode: t
>   dtrt-indent-mode: t
>   company-box-mode: t
>   company-mode: t
>   flycheck-posframe-mode: t
>   recentf-mode: t
>   flycheck-mode: t
>   global-subword-mode: t
>   subword-mode: t
>   +popup-mode: t
>   doom-modeline-mode: t
>   override-global-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   eldoc-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tab-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>   size-indication-mode: t
>   column-number-mode: t
>   line-number-mode: t
>   transient-mark-mode: t
>   hs-minor-mode: t
>
> Load-path shadows:
> /Users/umar/.config/emacs/elpa/magit-20210916.1754/magit-section-pkg hides
> /Users/umar/.config/emacs/elpa/magit-section-20210829.1849/magit-section-pkg
> /Users/umar/.config/emacs/elpa/protobuf-mode-20200619.1742/protobuf-mode
> hides /usr/local/share/emacs/site-lisp/protobuf/protobuf-mode
> /Users/umar/.config/emacs/elpa/transient-20210819.2118/transient hides
> /usr/local/Cellar/emacs-plus@28/28.0.50/share/emacs/28.0.50/lisp/transient
>
> Features:
> (shadow sort emacsbug dap-variables dap-hydra nano-light-theme
> nano-theme nano-modeline autoload tar-mode arc-mode archive-mode
> mm-archive tetris gamegrid two-column git-rebase org-gcal persist
> org-generic-id request-deferred deferred htmlize novice rainbow-mode
> wgrep gorepl-mode bongo lastfm-submit calc-frac eieio-opt shortdoc
> flyspell-lazy flyspell forge-list forge-commands forge-semi
> forge-bitbucket buck forge-gogs gogs forge-gitea gtea forge-gitlab glab
> forge-github ghub-graphql treepy gsexp ghub forge-notify forge-revnote
> forge-pullreq forge-issue forge-topic yaml forge-post forge-repo forge
> forge-core forge-db closql pcmpl-unix pcmpl-gnu osx-dictionary
> hippie-exp winner calc-math edraw-color-picker edraw-color edraw-path
> edraw-dom-svg edraw-math edraw-util debug saveplace-pdf-view pdf-sync
> pdf-outline pdf-links pdf-history browse-at-remote
> rectangular-region-mode mc-hide-unmatched-lines-mode mc-mark-more
> mc-cycle-cursors multiple-cursors-core counsel-jq dumb-jump mail-extr
> artist picture reporter rect bug-reference magit-extras magit-delta
> xterm-color magit-bookmark magit-submodule magit-obsolete magit-blame
> magit-stash magit-reflog magit-bisect magit-push magit-pull magit-fetch
> magit-clone magit-remote magit-commit magit-sequence magit-notes
> magit-worktree magit-tag magit-merge magit-branch magit-reset
> magit-files magit-refs magit-status magit magit-repos magit-apply
> magit-wip magit-log which-func magit-diff git-commit log-edit message
> rfc822 mml mml-sec epa mm-decode mm-bodies mm-encode mailabbrev
> gmm-utils add-log magit-core magit-autorevert magit-margin
> magit-transient magit-process with-editor magit-mode magit-git
> magit-utils esxml nov esxml-query smerge-mode cl-print doom-one-theme
> olivetti popup expand-region subword-mode-expansions
> text-mode-expansions cc-mode-expansions the-org-mode-expansions
> js-mode-expansions html-mode-expansions css-mode-expansions
> er-basic-expansions expand-region-core expand-region-custom helpful
> trace edebug backtrace info-look elisp-refs help-fns radix-tree ivy-xref
> smart-jump-lisp-mode smart-jump-go-mode smart-jump-elisp-mode
> smart-jump-cc-mode smart-jump shr-color url-cache zoom repeat
> +projectile-find-file vterm docker-tramp tramp-cache tramp
> tramp-loaddefs trampver tramp-integration files-x tramp-compat ls-lisp
> vterm-module term/xterm xterm shell-pop term shell ehelp format-all
> language-id inheritenv org-clock calibredb-ivy calibredb-utils
> calibredb-annotation calibredb-transient calibredb-show calibredb-faces
> calibredb-search calibredb-core sendmail org-archive org-ql-search
> org-ql-view transient ov crm org-super-agenda org-ql peg ts anki-editor
> request mailheader ox-odt rng-loc rng-uri rng-parse rng-match rng-dt
> rng-util rng-pttrn nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex
> ox-icalendar ox-html table ox-ascii ox-publish ox tabify timezone
> cal-move parse-time hide-mode-line org-roam-protocol org-protocol
> org-roam-migrate org-roam-mode org-roam-capture org-roam-node
> org-roam-db org-roam-utils org-roam-compat org-roam org-capture org-id
> emacsql-sqlite url-http url-auth mail-parse rfc2231 url-gw emacsql
> emacsql-compiler magit-section misearch multi-isearch calc-arith cal-dst
> calc-misc calc-forms calccomp calc-units calc-alg calc-menu counsel-calc
> autoinsert org-wild-notifier async alert log4e notifications dbus gntp
> org-timeline ace-window avy diary-lib diary-loaddefs cal-iso
> org-duration cursor-sensor keepass-mode makefile-executor make-mode
> conf-mode flycheck-plantuml plantuml-mode sh-script executable eimp
> mhtml-mode css-mode smie eww url-queue shr kinsoku svg xml mm-url gnus
> nnheader gnus-util rmail rmail-loaddefs rfc2047 rfc2045 ietf-drums
> mail-utils mm-util mail-prsvr smartparens-html sgml-mode diredfl
> all-the-icons-dired vc-mtn vc-hg vc-bzr vc-src vc-sccs vc-svn vc-cvs
> vc-rcs dired-filter dired-hacks-utils dired-x diff-hl-dired diff-hl
> log-view pcvs-util vc-dir vc flycheck-golangci-lint dap-go go-mode
> find-file ffap etags fileloop terraform-mode hcl-mode sql
> lsp-diagnostics lsp-modeline lsp-ui lsp-ui-flycheck lsp-ui-doc xwidget
> goto-addr lsp-ui-imenu lsp-ui-peek lsp-ui-sideline lsp-ui-util view
> flycheck-phpstan phpstan dap-php dap-utils php-mode speedbar ezimage
> dframe php-face php php-project flymake-proc flymake company-dabbrev
> org-superstar lsp-zig lsp-steep lsp-svelte lsp-sqls lsp-yaml lsp-xml
> lsp-vimscript lsp-vhdl lsp-vetur lsp-html lsp-verilog lsp-vala lsp-v
> lsp-terraform lsp-tex lsp-sorbet lsp-solargraph lsp-rust lsp-rf lsp-r
> lsp-purescript lsp-pylsp lsp-pyls lsp-pwsh lsp-php lsp-perl lsp-ocaml
> lsp-nix lsp-nim lsp-markdown lsp-lua lsp-kotlin lsp-json lsp-javascript
> lsp-haxe lsp-groovy lsp-hack lsp-graphql lsp-go lsp-completion
> lsp-gdscript lsp-fsharp lsp-fortran lsp-eslint lsp-erlang lsp-elixir
> lsp-elm lsp-dockerfile lsp-dhall lsp-d lsp-css lsp-csharp gnutls
> lsp-crystal lsp-cmake lsp-clojure lsp-semantic-tokens lsp-clangd dom
> lsp-beancount lsp-bash lsp-angular lsp-ada lsp-actionscript json-mode
> json-reformat json-snatcher smartparens-javascript js
> org-fancy-priorities org-appear org-pretty-table org-pdftools pdf-annot
> facemenu pdf-occur tablist tablist-filter semantic/wisent/comp
> semantic/wisent semantic/wisent/wisent semantic/util-modes semantic/util
> semantic semantic/tag semantic/lex semantic/fw mode-local cedet
> pdf-isearch let-alist pdf-misc pdf-tools pdf-view treemacs-bookmarks
> bookmark jka-compr pdf-cache pdf-info tq pdf-util pdf-macs image-mode
> exif org-noter spell-fu ispell org-indent image-file image-converter
> org-element avl-tree generator org-habit org-agenda org-refile ol-bibtex
> bibtex iso8601 smartparens-org ob-plantuml org ob ob-tangle ob-ref
> ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
> org-pcomplete pcomplete org-list org-faces org-entities org-version
> ob-emacs-lisp ob-core ob-eval org-table ol org-keys org-compat org-macs
> org-loaddefs format-spec cal-menu calendar cal-loaddefs time-date
> dap-mouse dap-ui lsp-treemacs lsp-treemacs-themes treemacs
> treemacs-header-line treemacs-compatibility treemacs-mode
> treemacs-interface treemacs-extensions treemacs-mouse-interface
> treemacs-tags treemacs-persistence treemacs-filewatch-mode
> treemacs-follow-mode treemacs-rendering treemacs-async
> treemacs-workspaces treemacs-dom treemacs-visuals
> treemacs-fringe-indicator treemacs-scope pulse treemacs-faces
> treemacs-icons treemacs-themes treemacs-core-utils pfuture
> treemacs-logging treemacs-customization treemacs-macros gdb-mi gud bui
> bui-list bui-info bui-entry bui-core bui-history bui-button bui-utils
> cus-edit pp cus-start cus-load lsp-lens dap-mode dap-launch dap-overlays
> lsp-mode lsp-protocol spinner network-stream puny nsm rmc
> smartparens-markdown markdown-mode noutline outline inline imenu ht ewoc
> epg epg-config yasnippet vc-git diff-mode vc-dispatcher ws-butler
> whitespace rot13 disp-table protobuf-mode smartparens-c cc-mode cc-fonts
> cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
> tree-sitter tree-sitter-load tree-sitter-cli tsc tsc-dyn tsc-dyn-get
> dired-aux tsc-obsolete gumshoe mini-frame which-key selected move-text
> smartparens-config smartparens-text smartparens undo-tree diff so-long
> all-the-icons-ivy all-the-icons-ivy-rich ivy-rich counsel-projectile
> projectile lisp-mnt grep ibuffer-vc ibuf-ext ibuffer ibuffer-loaddefs
> thingatpt counsel xdg xref project compile text-property-search comint
> swiper ivy delsel ivy-faces ivy-overlay colir color server saveplace
> dired dired-loaddefs osx-trash git-gutter-fringe fringe-helper
> git-gutter autorevert filenotify time desktop frameset eros
> display-line-numbers hl-line highlight-numbers parent-mode paren
> dtrt-indent company-box company-box-doc frame-local company-box-icons
> company-yasnippet company-capf company flycheck-posframe posframe
> hideshow recentf tree-widget wid-edit init core-misc core-plantuml
> core-elisp core-org core-php core-markdown core-javascript core-go
> core-secrets core-ebook core-shell core-tools calc-aent calc-prog
> calc-ext calc calc-loaddefs calc-macs exec-path-from-shell core-vc
> core-tramp core-dired core-session core-debug core-project ibuf-macs
> core-navigation hydra ring lv core-checker flycheck ansi-color find-func
> core-completion core-editing cap-words superword subword pcase
> core-window +popup core-ux advice core-ui doom-dashboard derived
> doom-modeline doom-modeline-segments doom-modeline-env
> doom-modeline-core comp comp-cstr warnings shrink-path f s all-the-icons
> all-the-icons-faces data-material data-weathericons data-octicons
> data-fileicons data-faicons data-alltheicons dash doom-themes-ext-org
> doom-themes-ext-treemacs doom-one-light-theme solaire-mode face-remap
> doom-themes doom-themes-base cl-extra help-mode core-util use-package
> use-package-ensure use-package-delight use-package-diminish
> use-package-bind-key bind-key easy-mmode use-package-core finder-inf rx
> edmacro kmacro w3m-load info package browse-url url url-proxy
> url-privacy url-expand url-methods url-history url-cookie url-domsuf
> url-util mailcap url-handlers url-parse auth-source cl-seq eieio
> eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
> url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
> iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
> lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util
> term/common-win tool-bar dnd fontset image regexp-opt fringe
> tabulated-list replace newcomment text-mode elisp-mode lisp-mode
> prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
> timer select scroll-bar mouse jit-lock font-lock syntax font-core
> term/tty-colors frame minibuffer cl-generic cham georgian utf-8-lang
> misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
> cp51932 hebrew greek romanian slovak czech european ethiopic indian
> cyrillic chinese composite charscript charprop case-table epa-hook
> jka-cmpr-hook help simple abbrev obarray cl-preloaded nadvice button
> loaddefs faces cus-face macroexp files window text-properties overlay
> sha1 md5 base64 format env code-pages mule custom widget
> hashtable-print-readable backquote threads xwidget-internal kqueue cocoa
> ns lcms2 multi-tty make-network-process native-compile emacs)
>
> Memory information:
> ((conses 16 5681850 755118)
>  (symbols 48 140725 0)
>  (strings 32 851093 57331)
>  (string-bytes 1 29748886)
>  (vectors 16 393667)
>  (vector-slots 8 7190110 587972)
>  (floats 8 18681 3660)
>  (intervals 56 571161 8020)
>  (buffers 992 271))
>
>
> --
> Regards,
> Umar Ahmad
>

-- 
Regards,
Umar Ahmad