emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Display problems with 'before-string in overlay


From: Chong Yidong
Subject: Re: Display problems with 'before-string in overlay
Date: Sun, 15 Apr 2007 12:40:14 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.97 (gnu/linux)

"Lennart Borgman (gmail)" <address@hidden> writes:

> Here is a version that I believe works. It just does local changes to
> cursor_row_p. I seems to me that is sufficient. I have not seen any
> problems with the display of 'display property parts, only with cursor
> positioning.

Thanks for the patch.

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]