Subject: bug#32848: 26.1; follow-mode cursor move breaks with frame-resize-pixelwise

From: Allen Li <[email-masked]>
Date: Wed, 26 Sep 2018 15:49:15 -0700

Moving the cursor off the bottom of the window with follow-mode enabled
doesn't move to the other window properly if frame-resize-pixelwise is
set and a partial line is visible.

Reproduce:

0. (Must be running X and GUI Emacs.  A big/wide monitor helps.)
1. Save a long text file:

  for i in $(seq 1 300); do echo $i >> /tmp/tmp; done

2. emacs -Q
3. M-: (setq frame-resize-pixelwise t) RET
4. C-x 5 2 (new frame so it picks up the new frame setting)
5. C-x C-f /tmp/tmp RET
6. M-x follow-mode RET
7. C-x 3
8. Resize the frame so that half of a line is visible at the bottom of
the window.
9. Hold C-n to move the cursor down past the bottom of the current
window.

Expected:

The cursor/window focus moves to the next window per follow-mode.

Actual:

The cursor/window focus moves to the next window, then on the next C-n
jumps back to the previous window.  This appears to be because moving
the cursor onto the final half line in the window triggers both:

1. follow-mode to move the cursor/window focus to the next window.
2. The cursor moved off the edge of the current window, causing the
current window to scroll and recenter around the cursor.
3. This makes the position of the "shared" follow-mode cursor visible once
   again in the first window, causing focus to jump back to the first window.

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.22.24), modified by Debian
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Debian GNU/Linux rodete (upgraded from: Ubuntu 14.04 LTS)

Configured using:
 'configure --build x86_64-linux-gnu --build x86_64-linux-gnu
 --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/google-emacs:/etc/emacs:/usr/local/share/emacs/26.1+gg1+9/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/26.1+gg1+9/site-lisp:/usr/share/emacs/site-lisp
 --with-crt-dir=/usr/lib/x86_64-linux-gnu --disable-build-details
 --disable-silent-rules --with-modules GOOGLE_VERSION=26.1+gg1+9
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 build_alias=x86_64-linux-gnu 'CFLAGS=-g -O2
 -fdebug-prefix-map=/tmpfs/build-debs.ryDbLk/emacs-26.1+gg1+9=.
-fstack-protector-strong
 -Wformat -Werror=format-security -Wall' LDFLAGS=-Wl,-z,relro
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' 'OBJCFLAGS=-g -O2
 -fdebug-prefix-map=/tmpfs/build-debs.ryDbLk/emacs-26.1+gg1+9=.
-fstack-protector-strong
 -Wformat -Werror=format-security''

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES THREADS JSON LCMS2