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: Lennart Borgman (gmail)
Subject: Re: Display problems with 'before-string in overlay
Date: Sun, 15 Apr 2007 16:34:13 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

Kim F. Storm wrote:
"Lennart Borgman (gmail)" <address@hidden> writes:

Just another note if someone else is trying this. Having coming back
to this several times today I am starting to believe that the way to
fix this is to change cursor_row_p. This was the original way that Kim
tried to solve it. Maybe Kim's solution with an added test of if the
"string" has the 'display property will solve the problem for now.

I am unable to test this now, since I do not understand how to check
for the 'display property in cursor_row_p. If someone can tell that I
will test.

That is _not_ easy.
You have to record that during redisplay (by display_line in the glyph
row) if you need that information later.


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.

If this way works (my test works) then as I said before this seems rather safe as far as the return value from cursor_row_p is concerned.

However I think the actual code I added in cursor_row_p must be checked carefully and perhaps rewritten. I have tried to use the ideas from set_cursor_from_row, but I may easily have misunderstood things. I am not good at C and the code in xdisp.c is complicated.

Here is the patch:


Index: xdisp.c
===================================================================
RCS file: /sources/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1146
diff -c -r1.1146 xdisp.c
*** xdisp.c     10 Apr 2007 15:57:25 -0000      1.1146
--- xdisp.c     15 Apr 2007 14:31:07 -0000
***************
*** 15858,15865 ****
         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,
--- 15858,15880 ----
         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)
!         {
!           /* Check for 'display property: */
!           int end = row->end.pos.charpos;
!           struct glyph *text_glyphs = row->glyphs[TEXT_AREA];
!           struct glyph *end_glyph = text_glyphs + row->used[TEXT_AREA];
!           struct glyph *glyph = end_glyph;
!           int q2 = -1;
!           while (-1 == q2 && glyph > text_glyphs) {
!             int gend2 = -1;
!             if (STRINGP (glyph->object))
!               gend2 = string_buffer_position(w, glyph->object, end);
!             if (gend2 > 0)
! q2 = Fget_char_property (make_number (gend2), Qdisplay, Qnil);
!             --glyph;
!           }
!           cursor_row_p = (row->continued_p || (q2 != -1) );
!         }
        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]