Subject: bug#36030: Changing the region or the point changes the way characters are displayed

From: Clément Pit-Claudel <[email-masked]>
Date: Fri, 31 May 2019 11:21:51 -0400

Hi all,

I'm seeing puzzling display changes when I change the selected region.  I have attached pictures.

This is the recipe I use:
* emacs -Q
* C-h h
* M-g c 767 (or go to the beginning of 'Здравствуйте')
* C-SPC C-f C-f C-f C-f C-f C-f C-f

As I press C-f to extend the region, the display of the strings on the 'Arabic (العربيّة)' line changes.
I see this problem fairly commonly when looking at non-ASCII text in Emacs; sometimes just moving the point around is enough.

The problem is the same with xft and xfthb. In fact, if I have one xfthb frame and one xft frame both displaying HELLO, changing the region in one alters the display of the characters in both.

Here is the output of C-u x =

---
             position: 874 of 3518 (25%), column: 14
            character: ة‎ (displayed as ة‎) (codepoint 1577, #o3051, #x629)
              charset: mule-unicode-0100-24ff (Unicode characters of the range U+0100..U+24FF.)
code point in charset: 0x2D69
               script: arabic
               syntax: w 	which means: word
             category: .:Base, R:Right-to-left (strong), b:Arabic
             to input: type "C-x 8 RET 629" or "C-x 8 RET ARABIC LETTER TEH MARBUTA"
          buffer code: #xD8 #xA9
            file code: #xD8 #xA9 (encoded by coding system utf-8-unix)
              display: composed to form "ة" (see below)

Composed using this font:
  xft:-kcst-KacstScreen-normal-normal-normal-*-16-*-*-*-*-0-iso10646-1
by these glyphs:
  [7 7 0 102 7 0 8 11 1 nil]

Character code properties: customize what to show
  name: ARABIC LETTER TEH MARBUTA
  old-name: ARABIC LETTER TAA MARBUTAH
  general-category: Lo (Letter, Other)
  decomposition: (1577) ('ة')

There are text properties here:
  charset              mule-unicode-0100-24ff
---

And here is some debug information:

---
Configured using:
 'configure -C --with-harfbuzz'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND GPM DBUS GSETTINGS GLIB NOTIFY INOTIFY
ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LIBSYSTEMD JSON PDUMPER
LCMS2 GMP

Important settings:
  value of $LC_MONETARY: en_DK.UTF-8
  value of $LC_NUMERIC: en_DK.UTF-8
  value of $LC_TIME: sv_SE.UTF-8
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  enriched-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  use-hard-newlines: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t
  view-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
rmail-loaddefs text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils pp wid-edit descr-text
help-mode cl-loaddefs cl-lib time-date thai-util thai-word lao-util
vc-git diff-mode easymenu easy-mmode disp-table enriched view elec-pair
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame 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 minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 148491 17252)
 (symbols 48 19615 1)
 (strings 32 78745 2506)
 (string-bytes 1 1949992)
 (vectors 16 20937)
 (vector-slots 8 1267056 145604)
 (floats 8 32 105)
 (intervals 56 479 3)
 (buffers 992 13))
---

I hope this is not a duplicate. I have a vague memory of a related bug, but I couldn't find it.

Clément.