emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Overlooked? display bug fix


From: Richard Stallman
Subject: Overlooked? display bug fix
Date: Sun, 30 Dec 2007 09:02:03 -0500

When you posted this patch, I replied that "slow is better than
broken".  But it looks like nothing like this patch was ever
installed.  Was some unrelated fix installed?  If not, could you
possibly finish and install this?

To: address@hidden
Subject: Re: Display problems with 'before-string in overlay
References: <address@hidden> <address@hidden>
        <address@hidden> <address@hidden>
        <address@hidden> <address@hidden>
        <address@hidden> <address@hidden>
        <address@hidden>
        <address@hidden>
        <address@hidden>
        <address@hidden>
        <address@hidden>
        <address@hidden>
        <address@hidden>
From: Chong Yidong <address@hidden>
Date: Sun, 15 Apr 2007 15:10:22 -0400
In-Reply-To: <address@hidden> (Richard Stallman's message of "Sun\, 15 Apr 2007 
15\:01\:26 -0400")
Message-ID: <address@hidden>
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Sender: Chong Yidong <address@hidden>
X-Scanned-By: MIMEDefang 2.42
X-Spam-Score: -2.599
X-Spam-Flag: NO
X-detected-kernel: Solaris 9.1

> I wasn't reading the messages about this while people appeared to be
> working on it.  There were a substantial number of them.
> Could you resend just to me the message which explained the problem?

Actually, I think the best candidate solution now is the patch Lennart
Borgman sent (once it is fixed up).  This is the message I replied
with:



My main concern with such an approach is that this will be slow for
long multi-line strings filling most of the window.  In such a case,
we will basically scan over all glyphs every redisplay cycle.  On the
other hand, maybe this situation need not bother us right now.

There are various problems with this patch:

  1. Due to an off-by-one error, you start scanning from beyond the
     end of the glyph row, which can cause a segfault.
  2. You have a mixup between Lisp_Object and int in the return value
     of Fget_char_property.
  3. The call to get_char property is unnecessary, since
     string_buffer_position checks only the display property.

I fixed up the patch; see below.

I still believe it's adviseable to hold off redisplay changes till
Emacs 22.2, but if RMS insists, I guess we might as well check it in
instead of continuing this thread.


*** emacs/src/xdisp.c.~1.1146.~ 2007-04-14 11:35:10.000000000 -0400
--- emacs/src/xdisp.c   2007-04-15 12:37:47.000000000 -0400
***************
*** 15850,15865 ****
       struct glyph_row *row;
  {
    int cursor_row_p = 1;
  
!   if (PT == MATRIX_ROW_END_CHARPOS (row))
      {
!       /* If the row ends with a newline from a string, we don't want
!        the cursor there, but we still want it at the start of the
!        string if the string starts in this row.
         If the row is continued it doesn't end in a newline.  */
        if (CHARPOS (row->end.string_pos) >= 0)
!       cursor_row_p = (row->continued_p
!                       || PT >= MATRIX_ROW_START_CHARPOS (row));
        else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
        {
          /* If the row ends in middle of a real character,
--- 15850,15886 ----
       struct glyph_row *row;
  {
    int cursor_row_p = 1;
+   int row_end_charpos = MATRIX_ROW_END_CHARPOS (row);
  
!   if (PT == row_end_charpos)
      {
!       /* If the row ends with a newline from a string (other than a
!        display string), we don't want the cursor there.
         If the row is continued it doesn't end in a newline.  */
        if (CHARPOS (row->end.string_pos) >= 0)
!       {
!         if (row->continued_p)
!           cursor_row_p = 1;
!         else
!           {
!             /* Check for `display' property.  */
!             struct glyph *beg = row->glyphs[TEXT_AREA];
!             struct glyph *end = beg + row->used[TEXT_AREA] - 1;
!             struct glyph *glyph;
!             Lisp_Object prop = Qnil;
! 
!             for (glyph = end;
!                  !STRINGP (glyph->object) && glyph > beg;
!                  --glyph)
!               ;
! 
!             cursor_row_p =
!               (STRINGP (glyph->object)
!                && (string_buffer_position (w, glyph->object,
!                                            row_end_charpos)
!                    > 0));
!           }
!       }
        else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
        {
          /* If the row ends in middle of a real character,





reply via email to

[Prev in Thread] Current Thread [Next in Thread]