Subject: 25.1.50; cursor-sensor-mode strangeness

From: Helmut Eller <[email-masked]>
Date: Tue, 02 Feb 2016 22:20:44 +0100

When executing the example below with: emacs -Q -nw -l test.el
Emacs prints
   "result: ((1 2 entered) (5 6 left))"
I would expect this instead:
   ((1 2 entered) (2 3 left) (4 5 entered) (5 6 left))

(progn
  (defvar test-result '())

  (defun test-sensor (_ pos entered/left)
    (push (list pos (point) entered/left) test-result))

  (defun test ()
    (interactive)
    (setq test-result '())
    (with-current-buffer (get-buffer-create "test")
      (erase-buffer)
      (insert "x")
      (insert (propertize "a" 'cursor-sensor-functions (list #'test-sensor)))
      (insert "y")
      (insert (propertize "b" 'cursor-sensor-functions (list #'test-sensor)))
      (insert "z")
      (cursor-sensor-mode 1)
      (save-selected-window
	(let ((win (display-buffer (current-buffer))))
	  (select-window win)
	  (goto-char (point-min)))
	(while (not (eobp))
	  (redisplay t)
	  (forward-char))
	(redisplay t)))
    (message "result: %S" (reverse test-result)))

  (test))

In GNU Emacs 25.1.50.3 (i686-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2016-01-29 built on ix
Repository revision: 487bd7aedf9bbbf0b939b653912253fbeb7d16b9
System Description:	Debian GNU/Linux 8.0 (jessie)

Configured using:
 'configure --with-jpeg=no --with-gif=no --with-tiff=no'

Configured features:
XPM PNG RSVG SOUND DBUS GSETTINGS NOTIFY LIBXML2 FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LANG: C.UTF-8
  locale-coding-system: utf-8-unix