unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
       [not found] <iq661ll235.fsf@localhost.localdomain>
@ 2002-05-20 14:47 ` Richard Stallman
  2002-05-20 19:23   ` Joe Wells
  2002-05-26 22:25 ` Richard Stallman
  2002-05-26 22:25 ` Richard Stallman
  2 siblings, 1 reply; 11+ messages in thread
From: Richard Stallman @ 2002-05-20 14:47 UTC (permalink / raw)
  Cc: emacs-devel

    ;; * The buffer's value of cursor-type is ignored when the buffer's
    ;; window is not the selected window.  Instead, the usual hollow box
    ;; cursor is displayed.

This is not a bug, but the documentation of cursor-type fails to say it.

However, it might be reasonable to change this.  Perhaps the cursor in
a nonselected window should have the same appearance as when the
cursor "blinks off".  For a bar cursor, this would mean it becomes a
thin bar.

What do people think of that idea?

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-20 14:47 ` Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible Richard Stallman
@ 2002-05-20 19:23   ` Joe Wells
  2002-05-21 15:57     ` Richard Stallman
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Wells @ 2002-05-20 19:23 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

> > The buffer's value of cursor-type is ignored when the buffer's
> > window is not the selected window.  Instead, the usual hollow box
> > cursor is displayed.
> 
> This is not a bug, but the documentation of cursor-type fails to say
> it.

It is a bug in the sense that it is contrary to the expectations of
anyone using the cursor-type variable.  That is, even if you think the
code is doing what you intended it to do, I think the intended
behavior is wrong.

> However, it might be reasonable to change this.  Perhaps the cursor
> in a nonselected window should have the same appearance as when the
> cursor "blinks off".  For a bar cursor, this would mean it becomes a
> thin bar.

I don't understand this, because when the cursor blinks off for me, it
disappears completely.

> What do people think of that idea?

There are several situations which can now result in distinct cursor
appearances:

  the window is selected

  the window is selected, the cursor is "blinking", and it has blinked
  "off"

  the window is not selected

There are also variations in the shape of the cursor (bar of various
thicknesses, block, hollow block, completely missing) and the color of
the cursor.

It seems to me that the shape and color of the cursor should be
selectable for each situation.  So you could make the cursor "blink"
by changing color or thickness instead of disappearing.

-- 
Joe Wells

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-20 19:23   ` Joe Wells
@ 2002-05-21 15:57     ` Richard Stallman
  2002-05-21 19:49       ` Joe Wells
  0 siblings, 1 reply; 11+ messages in thread
From: Richard Stallman @ 2002-05-21 15:57 UTC (permalink / raw)
  Cc: emacs-devel

    I don't understand this, because when the cursor blinks off for me, it
    disappears completely.

We have probably changed this since 21.2.

    It seems to me that the shape and color of the cursor should be
    selectable for each situation.  So you could make the cursor "blink"
    by changing color or thickness instead of disappearing.

Sure, we could do that, but that is clunky--it means lots and lots
more variables to customize, and I doubt it is worth the trouble
to add them all.  I would rather try the simpler change I proposed.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-21 15:57     ` Richard Stallman
@ 2002-05-21 19:49       ` Joe Wells
  0 siblings, 0 replies; 11+ messages in thread
From: Joe Wells @ 2002-05-21 19:49 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

>     I don't understand this, because when the cursor blinks off for
>     me, it disappears completely.
> 
> We have probably changed this since 21.2.
> 
>     It seems to me that the shape and color of the cursor should be
>     selectable for each situation.  So you could make the cursor
>     "blink" by changing color or thickness instead of disappearing.
> 
> Sure, we could do that, but that is clunky--it means lots and lots
> more variables to customize, and I doubt it is worth the trouble
> to add them all.  I would rather try the simpler change I proposed.

Regardless, I believe that setting the cursor shape to "bar" in a
buffer should affect all of the versions of the cursor: the "blinked
on", "blinked off", and "not selected window" versions.

-- 
Joe

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
       [not found] <iq661ll235.fsf@localhost.localdomain>
  2002-05-20 14:47 ` Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible Richard Stallman
@ 2002-05-26 22:25 ` Richard Stallman
  2002-05-31  8:35   ` Joe Wells
  2002-05-26 22:25 ` Richard Stallman
  2 siblings, 1 reply; 11+ messages in thread
From: Richard Stallman @ 2002-05-26 22:25 UTC (permalink / raw)
  Cc: emacs-devel

    ;; * The buffer's value of cursor-type is ignored when the buffer's
    ;; window is not the selected window.  Instead, the usual hollow box
    ;; cursor is displayed.

Do you like the results of this change?

*** xterm.c.~1.734.~	Sat May 25 17:30:04 2002
--- xterm.c	Sun May 26 17:25:30 2002
***************
*** 11649,11654 ****
--- 11649,11655 ----
    struct frame *f = XFRAME (w->frame);
    int new_cursor_type;
    int new_cursor_width;
+   int cursor_off_state = 0;
    struct glyph_matrix *current_glyphs;
    struct glyph_row *glyph_row;
    struct glyph *glyph;
***************
*** 11688,11738 ****
       marked off, draw no cursor.  In all other cases, we want a hollow
       box cursor.  */
    new_cursor_width = -1;
    if (cursor_in_echo_area
        && FRAME_HAS_MINIBUF_P (f)
        && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window))
      {
        if (w == XWINDOW (echo_area_window))
  	new_cursor_type = FRAME_DESIRED_CURSOR (f);
!       else if (!NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
! 					   w->buffer)))
! 	new_cursor_type = HOLLOW_BOX_CURSOR;
        else
  	new_cursor_type = NO_CURSOR;
      }
!   else
      {
!       if (f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame
! 	  || w != XWINDOW (f->selected_window))
! 	{
! 	  if ((MINI_WINDOW_P (w) && minibuf_level == 0)
! 	      || NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
! 					    w->buffer))
! 	      || NILP (XBUFFER (w->buffer)->cursor_type))
! 	    new_cursor_type = NO_CURSOR;
! 	  else
! 	    new_cursor_type = HOLLOW_BOX_CURSOR;
! 	}
        else
! 	{
! 	  struct buffer *b = XBUFFER (w->buffer);
  
! 	  if (EQ (b->cursor_type, Qt))
! 	    new_cursor_type = FRAME_DESIRED_CURSOR (f);
! 	  else
! 	    new_cursor_type = x_specified_cursor_type (b->cursor_type, 
! 						       &new_cursor_width);
! 	  if (w->cursor_off_p)
! 	    {
! 	      if (new_cursor_type == FILLED_BOX_CURSOR)
! 		new_cursor_type = HOLLOW_BOX_CURSOR;
! 	      else if (new_cursor_type == BAR_CURSOR && new_cursor_width > 1)
! 		new_cursor_width = 1;
! 	      else
! 		new_cursor_type = NO_CURSOR;
! 	    }
! 	}
      }
  
    /* If cursor is currently being shown and we don't want it to be or
       it is in the wrong place, or the cursor type is not what we want,
--- 11689,11748 ----
       marked off, draw no cursor.  In all other cases, we want a hollow
       box cursor.  */
    new_cursor_width = -1;
+   new_cursor_type = -2;
+ 
+   /* Echo area */
    if (cursor_in_echo_area
        && FRAME_HAS_MINIBUF_P (f)
        && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window))
      {
        if (w == XWINDOW (echo_area_window))
  	new_cursor_type = FRAME_DESIRED_CURSOR (f);
!       else if (NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
! 					  w->buffer)))
! 	new_cursor_type = NO_CURSOR;
        else
+ 	cursor_off_state = 1;
+     }
+ 
+   /* Nonselected window or nonselected frame.  */
+   else if (f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame
+ 	   || w != XWINDOW (f->selected_window))
+     {
+       if ((MINI_WINDOW_P (w) && minibuf_level == 0)
+ 	  || NILP (Fbuffer_local_value (Qcursor_in_non_selected_windows,
+ 					w->buffer))
+ 	  || NILP (XBUFFER (w->buffer)->cursor_type))
  	new_cursor_type = NO_CURSOR;
+       else
+ 	cursor_off_state = 1;
      }
! 
!   /* If new_cursor_type isn't decided yet, decide it now.  */
!   if (new_cursor_type == -2)
      {
!       struct buffer *b = XBUFFER (w->buffer);
! 
!       if (EQ (b->cursor_type, Qt))
! 	new_cursor_type = FRAME_DESIRED_CURSOR (f);
        else
! 	new_cursor_type = x_specified_cursor_type (b->cursor_type, 
! 						   &new_cursor_width);
!     }
  
!   /* Dim out or hollow out the cursor,
!      if it has blinked off or for nonselected windows.  */
!   if (w->cursor_off_p || cursor_off_state)
!     {
!       if (new_cursor_type == FILLED_BOX_CURSOR)
! 	new_cursor_type = HOLLOW_BOX_CURSOR;
!       else if (new_cursor_type == BAR_CURSOR && new_cursor_width > 1)
! 	new_cursor_width = 1;
!       else
! 	new_cursor_type = NO_CURSOR;
      }
+ 
+   /* Now new_cursor_type is correct.  */
  
    /* If cursor is currently being shown and we don't want it to be or
       it is in the wrong place, or the cursor type is not what we want,

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
       [not found] <iq661ll235.fsf@localhost.localdomain>
  2002-05-20 14:47 ` Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible Richard Stallman
  2002-05-26 22:25 ` Richard Stallman
@ 2002-05-26 22:25 ` Richard Stallman
  2002-05-26 23:29   ` Joe Wells
  2002-05-31  8:45   ` Joe Wells
  2 siblings, 2 replies; 11+ messages in thread
From: Richard Stallman @ 2002-05-26 22:25 UTC (permalink / raw)
  Cc: emacs-devel

    ;; * A display property of "" (the empty string) on any character in
    ;; the buffer causes a truly wacky event.  The buffer is effectively
    ;; partitioned into two portions, that before the first such
    ;; character, and that after...

Does this still happen in the CVS version?
Likewise for the other display property bugs.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-26 22:25 ` Richard Stallman
@ 2002-05-26 23:29   ` Joe Wells
  2002-05-31  8:45   ` Joe Wells
  1 sibling, 0 replies; 11+ messages in thread
From: Joe Wells @ 2002-05-26 23:29 UTC (permalink / raw)
  Cc: emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     ;; * A display property of "" (the empty string) on any character in
>     ;; the buffer causes a truly wacky event.  The buffer is effectively
>     ;; partitioned into two portions, that before the first such
>     ;; character, and that after...
> 
> Does this still happen in the CVS version?
> Likewise for the other display property bugs.

I don't know.  I haven't tried the CVS version.  I am not sure when I
will have time, perhaps sometime in the next month.

-- 
Joe

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-26 22:25 ` Richard Stallman
@ 2002-05-31  8:35   ` Joe Wells
  2002-06-01 21:03     ` Richard Stallman
  0 siblings, 1 reply; 11+ messages in thread
From: Joe Wells @ 2002-05-31  8:35 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

> ;; * The buffer's value of cursor-type is ignored when the buffer's
> ;; window is not the selected window.  Instead, the usual hollow box
> ;; cursor is displayed.
> 
> Do you like the results of this change?

I have built Emacs from the CVS version as of 2002-05-29 (Wednesday)
and I was pleased with the improved handling of the 'bar cursor-type.
As far as I am concerned, it resolves my complaint.

-- 
Joe

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-26 22:25 ` Richard Stallman
  2002-05-26 23:29   ` Joe Wells
@ 2002-05-31  8:45   ` Joe Wells
  2002-06-01 21:05     ` Richard Stallman
  1 sibling, 1 reply; 11+ messages in thread
From: Joe Wells @ 2002-05-31  8:45 UTC (permalink / raw)


Richard Stallman <rms@gnu.org> writes:

> ;; * A display property of "" (the empty string) on any character in
> ;; the buffer causes a truly wacky event.  The buffer is effectively
> ;; partitioned into two portions, that before the first such
> ;; character, and that after...
> 
> Does this still happen in the CVS version?
> Likewise for the other display property bugs.

All of the other bugs I have reported still exist in the CVS version
as of 2002-05-29 (Wednesday).  some of them actually got a bit worse.

So you don't have to find the original message, I am including the
updated bug report below.

-- 
Joe

----------------------------------------------------------------------
;; Should be sent to (but hasn't): bug-gnu-emacs@gnu.org, emacs-pretest-bug@gnu.org
;; Actually sent to: emacs-devel@gnu.org
;; Subject: Emacs 21.3 (CVS) display bugs: properties: display, before-string, after-string, invisible, intangible

;; Emacs 21.3 (CVS) display bugs
;; affected overlay properties: display, before-string, after-string, invisible, intangible

;; bugs reported by: Joe Wells (<URL:http://www.cee.hw.ac.uk/~jbw/>)

;; In GNU Emacs 21.3.50.1 (i686-pc-linux-gnu, X toolkit)
;;  of 2002-05-29 on lxjbw
;; Important settings:
;;   value of $LC_ALL: nil
;;   value of $LC_COLLATE: nil
;;   value of $LC_CTYPE: nil
;;   value of $LC_MESSAGES: nil
;;   value of $LC_MONETARY: nil
;;   value of $LC_NUMERIC: nil
;;   value of $LC_TIME: nil
;;   value of $LANG: nil
;;   locale-coding-system: nil
;;   default-enable-multibyte-characters: t

;; Test cases to reproduce the buggy behavior are supplied for all
;; bugs reported in this message.

;; * A display property of "" (the empty string) on any character in
;; the buffer causes a truly wacky event.  The buffer is effectively
;; partitioned into two portions, that before the first such
;; character, and that after.  Only the first portion will be
;; displayed, even when point is in the second portion.  (If
;; scroll-step is set to a number greater than 0, then sometimes the
;; second portion will be displayed when point is in it.)
;; Furthermore, subsequent display property values appear to be
;; ignored.  There are 3 test cases for this bug.

;; *** Verified 21.3
(progn
  (kill-buffer (get-buffer-create "test"))
  (set-buffer (get-buffer-create "test"))
  (insert "ABCDEFGH")
  (let ((o (make-overlay 3 4))) ;; covering the "C"
    (overlay-put o 'display ""))
  (let ((o (make-overlay 7 8))) ;; covering the "F"
    (overlay-put o 'display ""))
  (display-buffer (current-buffer)))

;; *** Verified 21.3
(progn
  (kill-buffer (get-buffer-create "test"))
  (set-buffer (get-buffer-create "test"))
  (insert "ABCDEFGH")
  (let ((o (make-overlay 3 4))) ;; covering the "C"
    (overlay-put o 'display ""))
  (let ((o (make-overlay 7 8))) ;; covering the "F"
    (overlay-put o 'display ""))
  (goto-char (point-min))
  (display-buffer (current-buffer)))

;; *** Verified 21.3
(progn
  (kill-buffer (get-buffer-create "test"))
  (set-buffer (get-buffer-create "test"))
  (insert "ABCDEFGH")
  (let ((o (make-overlay 3 4))) ;; covering the "C"
    (overlay-put o 'display ""))
  (let ((o (make-overlay 7 8))) ;; covering the "F"
    (overlay-put o 'display "Z"))
  (display-buffer (current-buffer)))

;; * The "specified spaces" form of display specification causes wacky
;; cursor problems when the space is very small.  When point is just
;; before the first character of a range having such a specification,
;; the cursor is not displayed when the buffer's window is selected.
;; It does not matter whether the cursor is the default box cursor or
;; the bar cursor.  When the buffer's window is not selected, the
;; cursor is displayed as a hollow box that extends all the way to the
;; right edge of the window.  There are various other display things
;; that go wrong in this situation, too many to list.

;; *** Verified 21.3
(progn
  (kill-buffer (get-buffer-create "test"))
  (set-buffer (get-buffer-create "test"))
  (insert "ABCD")
  (goto-char 2) ;; between A and B
  (let ((o (make-overlay 2 4))) ;; covering the "BC"
    (overlay-put o 'display '(space :width 0.01)))
  (display-buffer (current-buffer)))

;; * A string-valued display property on a range of characters causes
;; cursor problems.  If point is just before all of the characters
;; with the string-valued display property, the cursor is displayed
;; _after_ the string which is displayed instead of the characters.

;; *** Verified 21.3
(progn
  (kill-buffer (get-buffer-create "test"))
  (set-buffer (get-buffer-create "test"))
  (insert "ABC")
  (let ((o (make-overlay 2 3))) ;; covering the B
    (overlay-put o 'display "Y"))
  (goto-char 2) ;; between A and B
  (display-buffer (current-buffer))
  (what-cursor-position) ;; shows point is _before_ the B
  )

;; * A before-string property on a range of characters causes cursor
;; problems.  If point is just before all of the characters with the
;; before-string property, the cursor is displayed _after_ the string
;; which is the value of the before-string property.

;; *** Verified 21.3
(progn
  (kill-buffer (get-buffer-create "test"))
  (set-buffer (get-buffer-create "test"))
  (insert "AB")
  (let ((o (make-overlay 2 3))) ;; covering the B
    (overlay-put o 'before-string "Y"))
  (goto-char 2) ;; between A and B
  (display-buffer (current-buffer))
  (what-cursor-position) ;; shows point is _before_ the B
  )

;; * An after-string and invisible property on a range of characters
;; causes cursor problems.  If point is just before all of the
;; characters with the after-string and non-nil invisible property,
;; the cursor is displayed _after_ the string which is the value of
;; the after-string property.

;; *** Verified 21.3
(progn
  (kill-buffer (get-buffer-create "test"))
  (set-buffer (get-buffer-create "test"))
  (insert "AB")
  (let ((o (make-overlay 2 3))) ;; covering the B
    (overlay-put o 'after-string "Y")
    (overlay-put o 'invisible t))
  (goto-char 2) ;; between A and B
  (display-buffer (current-buffer))
  (what-cursor-position) ;; shows point is _before_ the B
  )

;; * previous-line fails if there is no legal spot on the previous
;; line to move to.  However, backward-char works fine.  The next-line
;; function also has trouble in the buffer created by the test case.
;; (This is a change from my previous bug report for Emacs 21.2, where
;; I did not encounter any trouble with next-line.)

;; *** Verified 21.3, next-line now also has trouble
(progn
  (kill-buffer (get-buffer-create "test"))
  ;; The following subexpression is necessary to exhibit the bug
  ;; reliably.  Otherwise, the test case listed just above tends to
  ;; prevent the bug from appearing.
  (progn
    (delete-other-windows)
    (sit-for 0))
  (set-buffer (get-buffer-create "test"))
  (insert "A\nB\nC\nD\nE")
  (let ((o (make-overlay 3 8))) ;; covering the "B\nC\nD"
    (overlay-put o 'intangible t))
  (goto-char 8)
  (previous-line 1)
  (display-buffer (current-buffer))
  (what-cursor-position) ;; shows point has not moved from 8
  )

;; * Column numbers as used by previous-line and next-line have
;; surprising (to the naive user) effects when overlay or text
;; properties are used which cause additional characters to be
;; displayed or prevent characters in the buffer from being displayed.
;; Strictly speaking, this may not be a bug, but it is highly
;; undesirable behavior.  There should be a way to have motion to a
;; particular column based on what is displayed rather than on what is
;; in the buffer.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-31  8:35   ` Joe Wells
@ 2002-06-01 21:03     ` Richard Stallman
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2002-06-01 21:03 UTC (permalink / raw)
  Cc: emacs-devel

Thanks for calling my attention to the problem.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible
  2002-05-31  8:45   ` Joe Wells
@ 2002-06-01 21:05     ` Richard Stallman
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2002-06-01 21:05 UTC (permalink / raw)
  Cc: emacs-devel

    All of the other bugs I have reported still exist in the CVS version
    as of 2002-05-29 (Wednesday).  some of them actually got a bit worse.

Thank you.

Would someone like to investigate some of these bugs?
I wish I could, but I don't know the display code very well.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2002-06-01 21:05 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <iq661ll235.fsf@localhost.localdomain>
2002-05-20 14:47 ` Emacs 21.2 display bugs: variables: cursor-type; properties: display, before-string, after-string, invisible, intangible Richard Stallman
2002-05-20 19:23   ` Joe Wells
2002-05-21 15:57     ` Richard Stallman
2002-05-21 19:49       ` Joe Wells
2002-05-26 22:25 ` Richard Stallman
2002-05-31  8:35   ` Joe Wells
2002-06-01 21:03     ` Richard Stallman
2002-05-26 22:25 ` Richard Stallman
2002-05-26 23:29   ` Joe Wells
2002-05-31  8:45   ` Joe Wells
2002-06-01 21:05     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).