Subject: bug#62299: 29.0.60; NS port incorrect rendering

From: Kai Ma <[email-masked]>
Date: Tue, 21 Mar 2023 01:36:56 +0800

Hi emacs hackers,

I'm recently seeing quite a few "tearings" on the NS port: sometimes
some parts of the display are not cleared correctly, and sometimes some
parts are not drawn.  (I'm not sure if "tearing" is the correct term.)

In one case: the majority of the frame is cleared, but was not updated.

In some other cases, scrolling only scrolls part of the display, and the
display gets unreadable due to that.  One example:

When this happens, one has to M-x redraw-frame to clear the display and
redraw everything.

At first I thought this problem is infrequent enough not to be bothered,
but soon I find that this problem also happens even when I'm just
coding (the second screenshot attached above).

Unfortunately, I didn't find a 100% guaranteed way to reproduce this
problem.  However, if one is Telega user, they could probably reproduce
this relatively easily.  (Telega [1] is a Telegram client in Emacs.)
I'm able to get incorrect rendering once in <20 minutes using Telega.

Should you need any further information, please let me know.

[1] https://github.com/zevlg/telega.el

In GNU Emacs 29.0.60 (build 10, x86_64-apple-darwin22.3.0, NS
 appkit-2299.40 Version 13.2.1 (Build 22D68)) of 2023-03-16 built on
 Kais-MacBook.local
Repository revision: 499927d4756789f649b9d8aeaecb95a7eb3e3db1
Repository branch: emacs-29
Windowing system distributor 'Apple', version 10.3.2299
System Description:  macOS 13.2.1

Configured using:
 'configure --with-ns --with-xwidgets --with-json
 PKG_CONFIG_PATH=/usr/local/opt/openssl@3/lib/pkgconfig'

Configured features:
ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY
KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XIM XWIDGETS ZLIB

Important settings:
  value of $LC_ALL: zh_CN.utf-8
  value of $LANG: zh_CN.utf-8
  locale-coding-system: utf-8-unix

Major mode: ◁Chat

Minor modes in effect:
  telega-adblock-mode: t
  telega-root-auto-fill-mode: t
  telega-active-video-chats-mode: t
  telega-active-locations-mode: t
  telega-patrons-mode: t
  cursor-sensor-mode: t
  cursor-intangible-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  pdf-occur-global-minor-mode: t
  TeX-PDF-mode: t
  TeX-source-correlate-mode: t
  shell-dirtrack-mode: t
  treemacs-filewatch-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  global-wakatime-mode: t
  wakatime-mode: t
  diff-hl-margin-mode: t
  recentf-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  doom-modeline-mode: t
  winner-mode: t
  winum-mode: t
  which-key-mode: t
  global-hl-line-mode: t
  solaire-global-mode: t
  solaire-mode: t
  projectile-mode: t
  vertico-multiform-mode: t
  vertico-mouse-mode: t
  vertico-mode: t
  desktop-save-mode: t
  keyfreq-autosave-mode: t
  keyfreq-mode: t
  corfu-popupinfo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  marginalia-mode: t
  prescient-persist-mode: t
  global-ligature-mode: t
  ligature-mode: t
  ns-auto-titlebar-mode: t
  pixel-scroll-precision-mode: t
  save-place-mode: t
  server-mode: t
  electric-pair-mode: t
  global-so-long-mode: t
  delete-selection-mode: t
  global-auto-revert-mode: t
  override-global-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-history-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/Users/kaima/.emacs.d/elpa/transient-20230315.1520/transient hides /Applications/Emacs.app/Contents/Resources/lisp/transient

Features:
(shadow sort ecomplete mail-extr dumb-jump popup thai-util thai-word
cl-print ielm find-dired ripgrep wgrep consult-xref fish-protector
telega-adblock telega telega-obsolete telega-tdlib-events telega-webpage
telega-match emacsbug visual-fill-column telega-root telega-info
telega-chat telega-modes telega-filter telega-sort telega-company
telega-emoji telega-user telega-notifications notifications telega-voip
telega-ins telega-folders telega-inline telega-msg telega-tme
telega-sticker telega-i18n telega-vvnote telega-util rainbow-identifiers
telega-ffplay telega-media telega-tdlib telega-server telega-core
telega-customize cursor-sensor telega-autoloads tar-mode arc-mode
archive-mode visual-fill-column-autoloads rainbow-identifiers-autoloads
time dashboard dashboard-widgets ffap treemacs-mouse-interface files-x
org-indent org-latex-impatient posframe org-appear image-file
image-converter oc-basic ol-eww eww url-queue mm-url ol-rmail ol-mhe
ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime
smime dig gnus-sum gnus-group gnus-undo gnus-start gnus-dbus gnus-cloud
nnimap nnmail mail-source utf7 nnoo parse-time gnus-spec gnus-int
gnus-range gnus-win gnus nnheader range ol-docview doc-view ol-bibtex
bibtex iso8601 ol-bbdb ol-w3m ol-doi org-link-doi vc-hg vc-bzr vc-src
vc-sccs vc-svn vc-cvs vc-rcs bug-reference magit-extras magit-bookmark
magit-submodule 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
smerge-mode diff git-commit log-edit add-log magit-core magit-autorevert
magit-margin magit-transient magit-process with-editor magit-mode
magit-git org-protocol ob-rust jupyter jupyter-repl
jupyter-kernel-manager jupyter-channel jupyter-widget-client websocket
bindat simple-httpd jupyter-kernelspec jupyter-env jupyter-client
jupyter-mime jupyter-comm-layer jupyter-messages hmac-def jupyter-base
eieio-base org-noter org-noter-djvu org-noter-nov nov shr pixel-fill
kinsoku url-file esxml-query org-noter-pdf pdf-annot facemenu
org-noter-core 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 jka-compr pdf-cache
pdf-info tq pdf-util pdf-macs image-mode exif 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 org-agenda ox-html table
ox-ascii ox-publish ox org-download org-element org-persist xdg avl-tree
org-attach org-id org-refile async org-tempo tempo org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-src ob-comint org-pcomplete
org-list org-footnote org-faces org-entities ob-emacs-lisp ob-core
ob-eval org-cycle org-table ol org-fold org-fold-core org-keys oc
org-loaddefs cal-menu calendar cal-loaddefs org-compat org-version
org-macs helpful cc-langs cc-vars cc-defs trace edebug debug backtrace
info-look find-func help-fns elisp-refs consult-vertico consult
treemacs-bookmarks treemacs-tags imenu bookmark magit-base magit-section
info-colors align speedbar ezimage dframe haskell-mode haskell-cabal
haskell-utils haskell-font-lock haskell-indentation haskell-string
haskell-sort-imports haskell-lexeme haskell-align-imports
haskell-complete-module haskell-ghc-support etags fileloop generator
xref haskell-customize preview reftex-dcr reftex-auc cdlatex reftex
reftex-loaddefs reftex-vars noutline outline dbus font-latex latex
latex-flymake flymake-proc flymake tex-ispell tex-style tex crm texmathp
tex-mode shell pcomplete latexenc misearch multi-isearch vc-git
treemacs-all-the-icons treemacs-all-the-icons-autoloads treemacs-tab-bar
treemacs-tab-bar-autoloads treemacs-projectile
treemacs-projectile-autoloads loaddefs-gen radix-tree mm-archive message
sendmail yank-media rfc822 mml mml-sec epa epg rfc6068 gnus-util
mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils
gnutls network-stream url-cache url-http url-auth mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny epg-config
treemacs treemacs-header-line treemacs-compatibility treemacs-mode
treemacs-interface treemacs-persistence treemacs-filewatch-mode
treemacs-follow-mode treemacs-rendering treemacs-annotations
treemacs-async treemacs-workspaces treemacs-dom treemacs-visuals
treemacs-fringe-indicator treemacs-scope treemacs-faces treemacs-icons
treemacs-themes treemacs-core-utils pfuture inline ht treemacs-logging
treemacs-customization treemacs-macros all-the-icons-dired diredfl
dired-filter dired-hacks-utils dired-aux dired-x cus-edit pp cus-start
wakatime-mode autoinsert vertico-directory time-date pulse hideshow
display-line-numbers hl-todo rainbow-delimiters symbol-overlay
diff-hl-margin diff-hl-dired dired dired-loaddefs diff-hl log-view
pcvs-util vc-dir ewoc vc vc-dispatcher diff-mode recentf tree-widget
wid-edit yasnippet-snippets yasnippet doom-modeline
doom-modeline-segments doom-modeline-env doom-modeline-core shrink-path
f f-shortdoc s winner winum dash which-key hl-line solaire-mode
face-remap projectile project lisp-mnt grep compile comint ansi-osc
ansi-color ibuf-ext ibuffer ibuffer-loaddefs thingatpt vertico-multiform
vertico-mouse vertico catppuccin-theme desktop frameset cus-load keyfreq
prelude-irc prelude-apps gptel-transient warnings transient format-spec
gptel-curl gptel text-property-search mind-wave mind-wave-epc
prelude-mail prelude-os prelude-help prelude-lang-zig prelude-lang-web
prelude-lang-agda agda2 prelude-lang-haskell derived prelude-lang-js
prelude-lang-ml prelude-lang-coq prelude-lang-rust prelude-lang-python
prelude-lang-cc prelude-lang-lisp prelude-prog kind-icon svg-lib color
svg dom xml corfu-prescient corfu-popupinfo corfu prelude-blog
prelude-org prelude-tex prelude-git prelude-dired prelude-chinese
prelude-ibuffer prelude-search prelude-nix prelude-completion cape
marginalia orderless prescient char-fold prelude-project prelude-ui
icons ligature all-the-icons all-the-icons-faces data-material
data-weathericons data-octicons data-fileicons data-faicons
data-alltheicons ns-auto-titlebar pixel-scroll cua-base ring
prelude-core saveplace adaptive-wrap dabbrev server finder-inf elec-pair
diminish exec-path-from-shell undohist edmacro kmacro so-long delsel
autorevert filenotify prelude-benchmark benchmark-init advice cl-extra
help-mode prelude-common prelude-package vc-use-package use-package
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode prelude-loaddefs no-littering compat use-package-ensure
use-package-core rust-mode-autoloads citre-autoloads
no-littering-autoloads carbon-now-sh-autoloads benchmark-init-autoloads
pinyinlib-autoloads org-roam-ui-autoloads symbol-overlay-autoloads
cdlatex-autoloads ns-auto-titlebar-autoloads dap-mode-autoloads
ccls-autoloads geiser-autoloads wgrep-autoloads jupyter-autoloads
merlin-autoloads org-roam-bibtex-autoloads rainbow-delimiters-autoloads
helpful-autoloads go-translate-autoloads quickrun-autoloads
org-roam-autoloads yaml-mode-autoloads catppuccin-theme-autoloads
dired-filter-autoloads lsp-treemacs-autoloads zmq-autoloads
proof-general-autoloads proof-site proof-autoloads orderless-autoloads
lsp-ui-autoloads debbugs-autoloads rotate-autoloads vundo-autoloads
kind-icon-autoloads alert-autoloads auctex-autoloads tex-site
cape-autoloads helm-bibtex-autoloads org-download-autoloads
wakatime-mode-autoloads deft-autoloads dune-autoloads
all-the-icons-dired-autoloads smartparens-autoloads
dash-at-point-autoloads elfeed-autoloads treemacs-autoloads
cfrs-autoloads pfuture-autoloads org-ref-autoloads ox-pandoc-autoloads
bibtex-completion-autoloads hydra-autoloads htmlize-autoloads
lsp-docker-autoloads ace-window-autoloads avy-autoloads cider-autoloads
js2-mode-autoloads solaire-mode-autoloads ripgrep-autoloads
dumb-jump-autoloads elisp-refs-autoloads websocket-autoloads
rainbow-mode-autoloads simple-httpd-autoloads clojure-mode-autoloads
corfu-prescient-autoloads corfu-autoloads gntp-autoloads
adaptive-wrap-autoloads ligature-autoloads which-key-autoloads
lsp-mode-autoloads lv-autoloads spinner-autoloads company-coq-autoloads
company-math-autoloads cargo-autoloads vertico-autoloads
projectile-autoloads helm-autoloads info-colors-autoloads
zig-mode-autoloads one-themes-autoloads forge-autoloads yaml-autoloads
magit-autoloads pcase git-commit-autoloads closql-autoloads
utop-autoloads tuareg-autoloads rx caml-autoloads ghub-autoloads
web-mode-autoloads parseedn-autoloads doom-modeline-autoloads
shrink-path-autoloads expand-region-autoloads
modern-cpp-font-lock-autoloads embark-consult-autoloads
consult-autoloads embark-autoloads ob-rust-autoloads nix-mode-autoloads
magit-section-autoloads org-latex-impatient-autoloads undohist-autoloads
with-editor-autoloads prescient-autoloads hl-todo-autoloads
keyfreq-autoloads speed-type-autoloads pdf-tools-autoloads
tablist-autoloads ormolu-autoloads reformatter-autoloads
emacsql-autoloads diminish-autoloads dired-hacks-utils-autoloads
diredfl-autoloads org-appear-autoloads transient-autoloads
posframe-autoloads sesman-autoloads nix-sandbox-autoloads
flycheck-haskell-autoloads haskell-mode-autoloads flycheck-autoloads
pkg-info-autoloads epl-autoloads treepy-autoloads bui-autoloads
log4e-autoloads multiple-cursors-autoloads valign-autoloads
biblio-autoloads biblio-core-autoloads org-noter-autoloads
markdown-mode-autoloads dashboard-autoloads citeproc-autoloads
parsebib-autoloads string-inflection-autoloads queue-autoloads
f-autoloads s-autoloads dockerfile-mode-autoloads
all-the-icons-ibuffer-autoloads all-the-icons-autoloads
math-symbol-lists-autoloads parseclj-autoloads nov-autoloads
esxml-autoloads kv-autoloads helm-core-autoloads async-autoloads
marginalia-autoloads compat-autoloads svg-lib-autoloads
diff-hl-autoloads company-autoloads minimap-autoloads
google-translate-autoloads popup-autoloads vc-use-package-autoloads
winum-autoloads yasnippet-snippets-autoloads yasnippet-autoloads
sly-autoloads exec-path-from-shell-autoloads vterm-autoloads
ht-autoloads info dash-autoloads package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode 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 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 nadvice seq simple cl-generic
indonesian philippine 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 emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads xwidget-internal dbusbind
kqueue cocoa ns lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 3080389 1070281)
 (symbols 48 73440 10)
 (strings 32 1043690 31576)
 (string-bytes 1 46690887)
 (vectors 16 161600)
 (vector-slots 8 2984143 628756)
 (floats 8 154480 5437)
 (intervals 56 40854 18667)
 (buffers 984 71))