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

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

Re: Emacs 21.1 display bug


From: Gerd Moellmann
Subject: Re: Emacs 21.1 display bug
Date: 24 Oct 2001 11:24:52 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50

Gustav HÃ¥llberg <gustav@virtutech.se> writes:

> Now the displaying of the text seems to work just fine, but I found
> another problem concerning cursor display.

Okay.  Could you please try this one:

Index: xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.650.4.3
retrieving revision 1.650.4.4
diff -c -r1.650.4.3 -r1.650.4.4
*** xterm.c     2001/10/23 12:02:39     1.650.4.3
--- xterm.c     2001/10/24 09:17:41     1.650.4.4
***************
*** 7516,7522 ****
    int i, past_end = 0;
  
    first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
!   row = row_containing_pos (w, charpos, first, NULL);
    if (row == NULL)
      {
        if (charpos < MATRIX_ROW_START_CHARPOS (first))
--- 7516,7522 ----
    int i, past_end = 0;
  
    first = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
!   row = row_containing_pos (w, charpos, first, NULL, 0);
    if (row == NULL)
      {
        if (charpos < MATRIX_ROW_START_CHARPOS (first))
Index: xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.671.4.7
retrieving revision 1.671.4.9
diff -c -r1.671.4.7 -r1.671.4.9
*** xdisp.c     2001/10/23 10:03:05     1.671.4.7
--- xdisp.c     2001/10/24 09:17:20     1.671.4.9
***************
*** 552,557 ****
--- 552,562 ----
  
  #if GLYPH_DEBUG
  
+ /* Variables to turn off display optimizations from Lisp.  */
+ 
+ int inhibit_try_window_id, inhibit_try_window_reusing;
+ int inhibit_try_cursor_movement;
+ 
  /* Non-zero means print traces of redisplay if compiled with
     GLYPH_DEBUG != 0.  */
  
***************
*** 9686,9691 ****
--- 9691,9701 ----
    struct frame *f = XFRAME (w->frame);
    int rc = CURSOR_MOVEMENT_CANNOT_BE_USED;
    
+ #ifdef GLYPH_DEBUG
+   if (inhibit_try_cursor_movement)
+     return rc;
+ #endif
+ 
    /* Handle case where text has not changed, only point, and it has
       not moved off the frame.  */
    if (/* Point may be in this window.  */
***************
*** 10622,10627 ****
--- 10632,10642 ----
    struct glyph_row *start_row;
    int start_vpos, min_y, max_y;
  
+ #ifdef GLYPH_DEBUG
+   if (inhibit_try_window_reusing)
+     return 0;
+ #endif
+ 
    if (/* This function doesn't handle terminal frames.  */
        !FRAME_WINDOW_P (f)
        /* Don't try to reuse the display if windows have been split
***************
*** 10698,10723 ****
              int dy = it.current_y - first_row_y;
              
              row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
!             while (MATRIX_ROW_DISPLAYS_TEXT_P (row))
!               {
!                 if (PT >= MATRIX_ROW_START_CHARPOS (row)
!                     && PT < MATRIX_ROW_END_CHARPOS (row))
!                   {
!                     set_cursor_from_row (w, row, w->current_matrix, 0, 0,
!                                          dy, nrows_scrolled);
!                     break;
!                   }
!                 
!                 if (MATRIX_ROW_BOTTOM_Y (row) + dy >= it.last_visible_y)
!                   break;
!                 
!                 ++row;
!               }
!             
!             /* Give up if point was not found.  This shouldn't
!                happen often; not more often than with try_window
!                itself.  */
!             if (w->cursor.vpos < 0)
                {
                  clear_glyph_matrix (w->desired_matrix);
                  return 0;
--- 10713,10723 ----
              int dy = it.current_y - first_row_y;
              
              row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
!             row = row_containing_pos (w, PT, row, NULL, dy);
!             if (row)
!               set_cursor_from_row (w, row, w->current_matrix, 0, 0,
!                                    dy, nrows_scrolled);
!             else
                {
                  clear_glyph_matrix (w->desired_matrix);
                  return 0;
***************
*** 11193,11202 ****
     containing CHARPOS or null.  */
  
  struct glyph_row *
! row_containing_pos (w, charpos, start, end)
       struct window *w;
       int charpos;
       struct glyph_row *start, *end;
  {
    struct glyph_row *row = start;
    int last_y;
--- 11193,11203 ----
     containing CHARPOS or null.  */
  
  struct glyph_row *
! row_containing_pos (w, charpos, start, end, dy)
       struct window *w;
       int charpos;
       struct glyph_row *start, *end;
+      int dy;
  {
    struct glyph_row *row = start;
    int last_y;
***************
*** 11208,11225 ****
    if ((end && row >= end) || !row->enabled_p)
      return NULL;
    
!   last_y = window_text_bottom_y (w);
        
    while ((end == NULL || row < end)
         && (MATRIX_ROW_END_CHARPOS (row) < charpos
-            /* The end position of a row equals the start
-               position of the next row.  If CHARPOS is there, we
-               would rather display it in the next line, except
-               when this line ends in ZV.  */
             || (MATRIX_ROW_END_CHARPOS (row) == charpos
!                && (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)
!                    || !row->ends_at_zv_p)))
!        && MATRIX_ROW_BOTTOM_Y (row) < last_y)
      ++row;
        
    /* Give up if CHARPOS not found.  */
--- 11209,11226 ----
    if ((end && row >= end) || !row->enabled_p)
      return NULL;
    
!   last_y = window_text_bottom_y (w) - dy;
        
    while ((end == NULL || row < end)
+        && MATRIX_ROW_BOTTOM_Y (row) < last_y
         && (MATRIX_ROW_END_CHARPOS (row) < charpos
             || (MATRIX_ROW_END_CHARPOS (row) == charpos
!                /* The end position of a row equals the start
!                   position of the next row.  If CHARPOS is there, we
!                   would rather display it in the next line, except
!                   when this line ends in ZV.  */
!                && !row->ends_at_zv_p
!                && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))))
      ++row;
        
    /* Give up if CHARPOS not found.  */
***************
*** 11288,11293 ****
--- 11289,11299 ----
    struct text_pos start;
    int first_changed_charpos, last_changed_charpos;
  
+ #ifdef GLYPH_DEBUG
+   if (inhibit_try_window_id)
+     return 0;
+ #endif
+ 
    /* This is handy for debugging.  */
  #if 0
  #define GIVE_UP(X)                                            \
***************
*** 11423,11429 ****
            }
        
          /* Set the cursor.  */
!         row = row_containing_pos (w, PT, r0, NULL);
          set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
          return 1;
        }
--- 11429,11435 ----
            }
        
          /* Set the cursor.  */
!         row = row_containing_pos (w, PT, r0, NULL, 0);
          set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
          return 1;
        }
***************
*** 11461,11467 ****
            = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
  
          /* Set the cursor.  */
!         row = row_containing_pos (w, PT, r0, NULL);
          set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
          return 2;
        }
--- 11467,11473 ----
            = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
  
          /* Set the cursor.  */
!         row = row_containing_pos (w, PT, r0, NULL, 0);
          set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
          return 2;
        }
***************
*** 11675,11681 ****
        {
          row = row_containing_pos (w, PT,
                                    MATRIX_FIRST_TEXT_ROW (w->current_matrix),
!                                   last_unchanged_at_beg_row + 1);
          if (row)
            set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
        }
--- 11681,11687 ----
        {
          row = row_containing_pos (w, PT,
                                    MATRIX_FIRST_TEXT_ROW (w->current_matrix),
!                                   last_unchanged_at_beg_row + 1, 0);
          if (row)
            set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
        }
***************
*** 11684,11690 ****
        else if (first_unchanged_at_end_row)
        {
          row = row_containing_pos (w, PT - delta,
!                                   first_unchanged_at_end_row, NULL);
          if (row)
            set_cursor_from_row (w, row, w->current_matrix, delta,
                                 delta_bytes, dy, dvpos);
--- 11690,11696 ----
        else if (first_unchanged_at_end_row)
        {
          row = row_containing_pos (w, PT - delta,
!                                   first_unchanged_at_end_row, NULL, 0);
          if (row)
            set_cursor_from_row (w, row, w->current_matrix, delta,
                                 delta_bytes, dy, dvpos);
***************
*** 12949,12959 ****
                      it->max_phys_ascent = phys_ascent;
                      it->max_phys_descent = phys_descent;
                    }
                  else
                    {
!                     /* Display element draws past the right edge of
!                        the window.  Restore positions to values
!                        before the element.  */
                      row->used[TEXT_AREA] = n_glyphs_before + i;
                  
                      /* Display continuation glyphs.  */
--- 12955,12978 ----
                      it->max_phys_ascent = phys_ascent;
                      it->max_phys_descent = phys_descent;
                    }
+                 else if (it->c == '\t' && FRAME_WINDOW_P (it->f))
+                   {
+                     /* A TAB that extends past the right edge of the
+                        window.  This produces a single glyph on
+                        window system frames.  We leave the glyph in
+                        this row and let it fill the row, but don't
+                        consume the TAB.  */
+                     it->continuation_lines_width += it->last_visible_x;
+                     row->ends_in_middle_of_char_p = 1;
+                     row->continued_p = 1;
+                     glyph->pixel_width = it->last_visible_x - x;
+                     it->starts_in_middle_of_char_p = 1;
+                   }
                  else
                    {
!                     /* Something other than a TAB that draws past
!                        the right edge of the window.  Restore
!                        positions to values before the element.  */
                      row->used[TEXT_AREA] = n_glyphs_before + i;
                  
                      /* Display continuation glyphs.  */
***************
*** 12961,12974 ****
                        produce_special_glyphs (it, IT_CONTINUATION);
                      row->continued_p = 1;
  
!                     /* A TAB takes us to the right edge of the window.  */
!                     if (it->c == '\t')
!                       {
!                         it->continuation_lines_width += it->last_visible_x;
!                         row->ends_in_middle_of_char_p = 1;
!                       }
!                     else
!                       it->continuation_lines_width += x;
                      
                      if (nglyphs > 1 && i > 0)
                        {
--- 12980,12986 ----
                        produce_special_glyphs (it, IT_CONTINUATION);
                      row->continued_p = 1;
  
!                     it->continuation_lines_width += x;
                      
                      if (nglyphs > 1 && i > 0)
                        {
***************
*** 14940,14945 ****
--- 14952,14971 ----
    DEFVAR_BOOL ("inhibit-eval-during-redisplay", 
&inhibit_eval_during_redisplay,
      "Non-nil means don't eval Lisp during redisplay.");
    inhibit_eval_during_redisplay = 0;
+ 
+ #ifdef GLYPH_DEBUG
+   DEFVAR_BOOL ("inhibit-try-window-id", &inhibit_try_window_id,
+              "Inhibit try_window_id display optimization.");
+   inhibit_try_window_id = 0;
+ 
+   DEFVAR_BOOL ("inhibit-try-window-reusing", &inhibit_try_window_reusing,
+              "Inhibit try_window_reusing display optimization.");
+   inhibit_try_window_reusing = 0;
+ 
+   DEFVAR_BOOL ("inhibit-try-cursor-movement", &inhibit_try_cursor_movement,
+              "Inhibit try_cursor_movement display optimization.");
+   inhibit_try_cursor_movement = 0;
+ #endif /* GLYPH_DEBUG */
  }
  
  



reply via email to

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