GNU bug report logs - #65382
27.1; Sometimes two cursors are unexpectedly shown

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Sat, 19 Aug 2023 12:19:02 UTC

Severity: normal

Found in version 27.1

To reply to this bug, email your comments to 65382 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 12:19:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Markus Triska <triska <at> metalevel.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 19 Aug 2023 12:19:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Markus Triska <triska <at> metalevel.at>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 14:11:57 +0200
To reproduce this issue, please save the forms below in the file
duplicate_cursor.el, and then open the file in Emacs with:

    $ emacs -Q duplicate_cursor.el

Next, evaluate the forms in the file with:

    M-x eval-buffer RET

The function `duplicate-cursor' is now defined. Invoke this function
with:

    M-x duplicate-cursor RET

A new buffer called duplicated-cursor is now selected. So far,
everything works as intended, and a single cursor is shown in the
penultimate line of the window, as expected, at the position of point.

Now the issue: Invoke `duplicate-cursor' again, i.e., please do again:

    M-x duplicate-cursor RET

Unexpectedly, two cursors now appear in the buffer duplicated-cursor:
One, as before, in the penultimate line of the window, and a second
cursor in the last line of the window. This second cursor is unexpected
and does not appear at the position of point, but one line below it.

If I then press C-p, a cursor is shown in the antepenultimate line of
the window. This works as expected. However, a second cursor is again
unexpectedly shown in the last line of the window. This second cursor
is also unexpectedly shown when I press C-p repeatedly from then on.

The expected situation in all cases above is that only a single cursor
is shown at all times, located at the position of point.

Please find below the forms I used to elicit this issue. Alternatively,
you can download duplicate_cursor.el from:

    https://www.metalevel.at/ei/duplicate_cursor.el

Can you reproduce the issue with this information? Please let me know if
anything else is needed.

Thank you and all the best,
Markus


(defface duplicated-cursor
  '((t
     (:height 151)))
  "Face for frame to illustrate the issue")

(set-frame-font (face-font 'duplicated-cursor))

(defun insert-height (h ascent)
  ;; use a PBM image, due to problems with XBM (see #36337)
  (insert-image `(image :type pbm
                        :data ,(format "P1\n1 %s\n%s" h (make-string h ?0))
                        :ascent ,ascent) "t"))

(defun goto-last-window-line ()
  (while (pos-visible-in-window-p)
    (insert "\n"))
  (delete-char -1))

(defun duplicate-cursor ()
  (interactive)
  (switch-to-buffer (get-buffer-create "duplicated-cursor"))
  (erase-buffer)
  (insert "\n\n")
  (insert-height 160 80)
  (let ((m (point-marker)))
    (insert-height 125 'center)
    (goto-last-window-line)
    (redisplay)
    (delete-region (point) m)
    (insert-height 112 'center)
    (insert "\n\n")
    (insert-height 6 100)
    (insert (propertize "\n"
                        'face '(:height 1)
                        'line-height t
                        'rear-nonsticky t))
    (goto-last-window-line)
    (previous-line)))


In GNU Emacs 27.1 (build 1, x86_64-apple-darwin15.3.0, X toolkit, Xaw scroll bars)
 of 2020-12-12 built on macbook
Windowing system distributor 'The X.Org Foundation', version 11.0.11502000
System Description:  Mac OS X 10.11.3


Configured using:
 'configure --prefix=/opt/local --disable-silent-rules --without-ns
 --without-dbus --without-gconf --without-libotf --without-m17n-flt
 --with-gmp --with-gnutls --with-json --with-xml2 --with-modules
 --infodir /opt/local/share/info/emacs --with-x-toolkit=lucid
 --without-xaw3d --without-imagemagick --with-xpm --with-jpeg
 --with-tiff --with-gif --with-png --with-lcms2 --without-rsvg
 --with-xft 'CFLAGS=-pipe -Os -arch x86_64'
 CPPFLAGS=-I/opt/local/include 'LDFLAGS=-L/opt/local/lib
 -Wl,-headerpad_max_install_names -lfreetype -lfontconfig -Wl,-no_pie
 -arch x86_64''

Configured features:
XPM JPEG TIFF GIF PNG GSETTINGS GLIB NOTIFY KQUEUE ACL GNUTLS LIBXML2
FREETYPE HARFBUZZ XFT ZLIB TOOLKIT_SCROLL_BARS LUCID X11 XDBE XIM
MODULES THREADS JSON PDUMPER LCMS2 GMP





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 12:47:01 GMT) Full text and rfc822 format available.

Message #8 received at 65382 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Markus Triska <triska <at> metalevel.at>
Cc: 65382 <at> debbugs.gnu.org
Subject: Re: bug#65382: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 15:46:45 +0300
> From: Markus Triska <triska <at> metalevel.at>
> Date: Sat, 19 Aug 2023 14:11:57 +0200
> 
> 
> To reproduce this issue, please save the forms below in the file
> duplicate_cursor.el, and then open the file in Emacs with:
> 
>     $ emacs -Q duplicate_cursor.el
> 
> Next, evaluate the forms in the file with:
> 
>     M-x eval-buffer RET
> 
> The function `duplicate-cursor' is now defined. Invoke this function
> with:
> 
>     M-x duplicate-cursor RET
> 
> A new buffer called duplicated-cursor is now selected. So far,
> everything works as intended, and a single cursor is shown in the
> penultimate line of the window, as expected, at the position of point.
> 
> Now the issue: Invoke `duplicate-cursor' again, i.e., please do again:
> 
>     M-x duplicate-cursor RET
> 
> Unexpectedly, two cursors now appear in the buffer duplicated-cursor:
> One, as before, in the penultimate line of the window, and a second
> cursor in the last line of the window. This second cursor is unexpected
> and does not appear at the position of point, but one line below it.

I cannot reproduce this.  I see just one cursor.

It could be that some or all of the magic constants you use need to be
adjusted for other systems due to slightly different sizes of the
default fonts and/or the initial frames.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 12:56:01 GMT) Full text and rfc822 format available.

Message #11 received at 65382 <at> debbugs.gnu.org (full text, mbox):

From: Markus Triska <triska <at> metalevel.at>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65382 <at> debbugs.gnu.org
Subject: Re: bug#65382: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 14:55:18 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> I cannot reproduce this.  I see just one cursor.
>
> It could be that some or all of the magic constants you use need to be
> adjusted for other systems due to slightly different sizes of the
> default fonts and/or the initial frames.

Thank you for trying this! Yes, unfortunately line heights sometimes
differ between systems even for identical programs, I previously filed
#34577 for this.

I will try to reproduce the present issue on a different system as well
in the hope that you can then also reproduce it.

Thank you and all the best,
Markus




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 13:12:01 GMT) Full text and rfc822 format available.

Message #14 received at 65382 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65382 <at> debbugs.gnu.org, Markus Triska <triska <at> metalevel.at>
Subject: Re: bug#65382: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 13:11:42 +0000
>
> I cannot reproduce this.  I see just one cursor.
>

I can reproduce this (with Emacs 24 up to 30).  But I don't see more than 
one cursor either: the "other" cursor appears to be a kind of visual 
glitch, it does not blink, and it vanishes after e.g. M-x TAB C-g, or 
moving another frame above the one on which the "other" cursor appears.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 13:19:02 GMT) Full text and rfc822 format available.

Message #17 received at 65382 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 65382 <at> debbugs.gnu.org, triska <at> metalevel.at
Subject: Re: bug#65382: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 16:18:23 +0300
> Date: Sat, 19 Aug 2023 13:11:42 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: Markus Triska <triska <at> metalevel.at>, 65382 <at> debbugs.gnu.org
> 
> I can reproduce this (with Emacs 24 up to 30).  But I don't see more than 
> one cursor either: the "other" cursor appears to be a kind of visual 
> glitch, it does not blink, and it vanishes after e.g. M-x TAB C-g, or 
> moving another frame above the one on which the "other" cursor appears.

Does it also vanish if you say "M-x redraw-display RET"?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 13:21:01 GMT) Full text and rfc822 format available.

Message #20 received at 65382 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65382 <at> debbugs.gnu.org, triska <at> metalevel.at
Subject: Re: bug#65382: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 13:20:42 +0000
>> I can reproduce this (with Emacs 24 up to 30).  But I don't see more 
>> than one cursor either: the "other" cursor appears to be a kind of 
>> visual glitch, it does not blink, and it vanishes after e.g. M-x TAB 
>> C-g, or moving another frame above the one on which the "other" cursor 
>> appears.
>
> Does it also vanish if you say "M-x redraw-display RET"?
>

Yes.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 13:49:02 GMT) Full text and rfc822 format available.

Message #23 received at 65382 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Gregory Heytings <gregory <at> heytings.org>
Cc: 65382 <at> debbugs.gnu.org, triska <at> metalevel.at
Subject: Re: bug#65382: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 16:48:22 +0300
> Date: Sat, 19 Aug 2023 13:20:42 +0000
> From: Gregory Heytings <gregory <at> heytings.org>
> cc: triska <at> metalevel.at, 65382 <at> debbugs.gnu.org
> 
> 
> >> I can reproduce this (with Emacs 24 up to 30).  But I don't see more 
> >> than one cursor either: the "other" cursor appears to be a kind of 
> >> visual glitch, it does not blink, and it vanishes after e.g. M-x TAB 
> >> C-g, or moving another frame above the one on which the "other" cursor 
> >> appears.
> >
> > Does it also vanish if you say "M-x redraw-display RET"?
> >
> 
> Yes.

So the other cursor is probably some artifact we didn't remove when we
should have.  Does it look like a cursor, or does it look like one of
the images that the recipe uses?

Also, what happens if you change the cursor-type to be, say, 'bar'
before running the recipe?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#65382; Package emacs. (Sat, 19 Aug 2023 13:56:01 GMT) Full text and rfc822 format available.

Message #26 received at 65382 <at> debbugs.gnu.org (full text, mbox):

From: Gregory Heytings <gregory <at> heytings.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 65382 <at> debbugs.gnu.org, triska <at> metalevel.at
Subject: Re: bug#65382: 27.1; Sometimes two cursors are unexpectedly shown
Date: Sat, 19 Aug 2023 13:55:51 +0000
>
> So the other cursor is probably some artifact we didn't remove when we 
> should have.
>

Yes.

>
> Does it look like a cursor, or does it look like one of the images that 
> the recipe uses?
>

It looks exactly like a cursor.  Changing the cursor color, or its style, 
displays something that looks like another cursor (but which, as I said, 
doesn't blink).  AFAICT the images are white boxes, so in emacs -Q you 
don't see them.





This bug report was last modified 259 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.