emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/dispnew.c


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/dispnew.c
Date: Tue, 04 Feb 2003 09:03:24 -0500

Index: emacs/src/dispnew.c
diff -c emacs/src/dispnew.c:1.312 emacs/src/dispnew.c:1.313
*** emacs/src/dispnew.c:1.312   Sun Jan 19 16:50:01 2003
--- emacs/src/dispnew.c Tue Feb  4 09:03:12 2003
***************
*** 317,323 ****
  
  int fonts_changed_p;
  
! /* Convert vpos and hpos from frame to window and vice versa. 
     This may only be used for terminal frames.  */
  
  #if GLYPH_DEBUG
--- 317,323 ----
  
  int fonts_changed_p;
  
! /* Convert vpos and hpos from frame to window and vice versa.
     This may only be used for terminal frames.  */
  
  #if GLYPH_DEBUG
***************
*** 368,379 ****
       int paused_p;
  {
    char *buf;
!   
    if (history_idx >= REDISPLAY_HISTORY_SIZE)
      history_idx = 0;
    buf = redisplay_history[history_idx].trace;
    ++history_idx;
!   
    sprintf (buf, "%d: window %p (`%s')%s\n",
           history_tick++,
           w,
--- 368,379 ----
       int paused_p;
  {
    char *buf;
! 
    if (history_idx >= REDISPLAY_HISTORY_SIZE)
      history_idx = 0;
    buf = redisplay_history[history_idx].trace;
    ++history_idx;
! 
    sprintf (buf, "%d: window %p (`%s')%s\n",
           history_tick++,
           w,
***************
*** 396,407 ****
       int paused_p;
  {
    char *buf;
!   
    if (history_idx >= REDISPLAY_HISTORY_SIZE)
      history_idx = 0;
    buf = redisplay_history[history_idx].trace;
    ++history_idx;
!   
    sprintf (buf, "%d: update frame %p%s",
           history_tick++,
           f, paused_p ? " ***paused***" : "");
--- 396,407 ----
       int paused_p;
  {
    char *buf;
! 
    if (history_idx >= REDISPLAY_HISTORY_SIZE)
      history_idx = 0;
    buf = redisplay_history[history_idx].trace;
    ++history_idx;
! 
    sprintf (buf, "%d: update frame %p%s",
           history_tick++,
           f, paused_p ? " ***paused***" : "");
***************
*** 490,496 ****
          bcopy (from, to, endt - from);
        }
      }
! }     
  
  
  
--- 490,496 ----
          bcopy (from, to, endt - from);
        }
      }
! }
  
  
  
***************
*** 530,536 ****
     is freed.  If the count gets negative, more structures were freed
     than allocated, i.e. one matrix was freed more than once or a bogus
     pointer was passed to this function.
!  
     If MATRIX->pool is null, this means that the matrix manages its own
     glyph memory---this is done for matrices on X frames.  Freeing the
     matrix also frees the glyph memory in this case.  */
--- 530,536 ----
     is freed.  If the count gets negative, more structures were freed
     than allocated, i.e. one matrix was freed more than once or a bogus
     pointer was passed to this function.
! 
     If MATRIX->pool is null, this means that the matrix manages its own
     glyph memory---this is done for matrices on X frames.  Freeing the
     matrix also frees the glyph memory in this case.  */
***************
*** 552,558 ****
        if (matrix->pool == NULL)
        for (i = 0; i < matrix->rows_allocated; ++i)
          xfree (matrix->rows[i].glyphs[LEFT_MARGIN_AREA]);
!       
        /* Free row structures and the matrix itself.  */
        xfree (matrix->rows);
        xfree (matrix);
--- 552,558 ----
        if (matrix->pool == NULL)
        for (i = 0; i < matrix->rows_allocated; ++i)
          xfree (matrix->rows[i].glyphs[LEFT_MARGIN_AREA]);
! 
        /* Free row structures and the matrix itself.  */
        xfree (matrix->rows);
        xfree (matrix);
***************
*** 655,661 ****
          && matrix->window_width == window_width)
        return;
      }
!   
    /* Enlarge MATRIX->rows if necessary.  New rows are cleared.  */
    if (matrix->rows_allocated < dim.height)
      {
--- 655,661 ----
          && matrix->window_width == window_width)
        return;
      }
! 
    /* Enlarge MATRIX->rows if necessary.  New rows are cleared.  */
    if (matrix->rows_allocated < dim.height)
      {
***************
*** 675,681 ****
    if (matrix->pool)
      {
        xassert (matrix->pool->glyphs);
!       
        if (w)
        {
          left = margin_glyphs_to_reserve (w, dim.width,
--- 675,681 ----
    if (matrix->pool)
      {
        xassert (matrix->pool->glyphs);
! 
        if (w)
        {
          left = margin_glyphs_to_reserve (w, dim.width,
***************
*** 685,700 ****
        }
        else
        left = right = 0;
!       
        for (i = 0; i < dim.height; ++i)
        {
          struct glyph_row *row = &matrix->rows[i];
!         
!         row->glyphs[LEFT_MARGIN_AREA] 
            = (matrix->pool->glyphs
               + (y + i) * matrix->pool->ncolumns
               + x);
!         
          if (w == NULL
              || row == matrix->rows + dim.height - 1
              || (row == matrix->rows && matrix->header_line_p))
--- 685,700 ----
        }
        else
        left = right = 0;
! 
        for (i = 0; i < dim.height; ++i)
        {
          struct glyph_row *row = &matrix->rows[i];
! 
!         row->glyphs[LEFT_MARGIN_AREA]
            = (matrix->pool->glyphs
               + (y + i) * matrix->pool->ncolumns
               + x);
! 
          if (w == NULL
              || row == matrix->rows + dim.height - 1
              || (row == matrix->rows && matrix->header_line_p))
***************
*** 716,722 ****
                = row->glyphs[LEFT_MARGIN_AREA] + dim.width;
            }
        }
!       
        matrix->left_margin_glyphs = left;
        matrix->right_margin_glyphs = right;
      }
--- 716,722 ----
                = row->glyphs[LEFT_MARGIN_AREA] + dim.width;
            }
        }
! 
        matrix->left_margin_glyphs = left;
        matrix->right_margin_glyphs = right;
      }
***************
*** 731,744 ****
        {
          struct glyph_row *row = matrix->rows;
          struct glyph_row *end = row + matrix->rows_allocated;
!         
          while (row < end)
            {
              row->glyphs[LEFT_MARGIN_AREA]
                = (struct glyph *) xrealloc (row->glyphs[LEFT_MARGIN_AREA],
                                             (dim.width
                                              * sizeof (struct glyph)));
!             
              /* The mode line never has marginal areas.  */
              if (row == matrix->rows + dim.height - 1
                  || (row == matrix->rows && matrix->header_line_p))
--- 731,744 ----
        {
          struct glyph_row *row = matrix->rows;
          struct glyph_row *end = row + matrix->rows_allocated;
! 
          while (row < end)
            {
              row->glyphs[LEFT_MARGIN_AREA]
                = (struct glyph *) xrealloc (row->glyphs[LEFT_MARGIN_AREA],
                                             (dim.width
                                              * sizeof (struct glyph)));
! 
              /* The mode line never has marginal areas.  */
              if (row == matrix->rows + dim.height - 1
                  || (row == matrix->rows && matrix->header_line_p))
***************
*** 767,773 ****
        matrix->left_margin_glyphs = left;
        matrix->right_margin_glyphs = right;
      }
!   
    /* Number of rows to be used by MATRIX.  */
    matrix->nrows = dim.height;
    xassert (matrix->nrows >= 0);
--- 767,773 ----
        matrix->left_margin_glyphs = left;
        matrix->right_margin_glyphs = right;
      }
! 
    /* Number of rows to be used by MATRIX.  */
    matrix->nrows = dim.height;
    xassert (matrix->nrows >= 0);
***************
*** 782,788 ****
             building desired matrices when this function runs.  */
          if (window_width < 0)
            window_width = window_box_width (w, -1);
!       
          /* Optimize the case that only the height has changed (C-x 2,
             upper window).  Invalidate all rows that are no longer part
             of the window.  */
--- 782,788 ----
             building desired matrices when this function runs.  */
          if (window_width < 0)
            window_width = window_box_width (w, -1);
! 
          /* Optimize the case that only the height has changed (C-x 2,
             upper window).  Invalidate all rows that are no longer part
             of the window.  */
***************
*** 807,813 ****
              if (INTEGERP (w->window_end_vpos)
                  && XFASTINT (w->window_end_vpos) >= i)
                w->window_end_valid = Qnil;
!         
              while (i < matrix->nrows)
                matrix->rows[i++].enabled_p = 0;
            }
--- 807,813 ----
              if (INTEGERP (w->window_end_vpos)
                  && XFASTINT (w->window_end_vpos) >= i)
                w->window_end_valid = Qnil;
! 
              while (i < matrix->nrows)
                matrix->rows[i++].enabled_p = 0;
            }
***************
*** 827,834 ****
            matrix->rows[i].enabled_p = 0;
        }
      }
!     
!   
    /* Remember last values to be able to optimize frame redraws.  */
    matrix->matrix_x = x;
    matrix->matrix_y = y;
--- 827,834 ----
            matrix->rows[i].enabled_p = 0;
        }
      }
! 
! 
    /* Remember last values to be able to optimize frame redraws.  */
    matrix->matrix_x = x;
    matrix->matrix_y = y;
***************
*** 939,945 ****
    xassert (start <= end);
    xassert (start >= 0 && start < matrix->nrows);
    xassert (end >= 0 && end <= matrix->nrows);
!   
    for (; start < end; ++start)
      matrix->rows[start].enabled_p = enabled_p != 0;
  }
--- 939,945 ----
    xassert (start <= end);
    xassert (start >= 0 && start < matrix->nrows);
    xassert (end >= 0 && end <= matrix->nrows);
! 
    for (; start < end; ++start)
      matrix->rows[start].enabled_p = enabled_p != 0;
  }
***************
*** 965,971 ****
        matrix->no_scrolling_p = 0;
      }
  }
!   
  
  /* Shift part of the glyph matrix MATRIX of window W up or down.
     Increment y-positions in glyph rows between START and END by DY,
--- 965,971 ----
        matrix->no_scrolling_p = 0;
      }
  }
! 
  
  /* Shift part of the glyph matrix MATRIX of window W up or down.
     Increment y-positions in glyph rows between START and END by DY,
***************
*** 978,998 ****
       int start, end, dy;
  {
    int min_y, max_y;
!   
    xassert (start <= end);
    xassert (start >= 0 && start < matrix->nrows);
    xassert (end >= 0 && end <= matrix->nrows);
!   
    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
!   
    for (; start < end; ++start)
      {
        struct glyph_row *row = &matrix->rows[start];
!       
        row->y += dy;
        row->visible_height = row->height;
!       
        if (row->y < min_y)
        row->visible_height -= min_y - row->y;
        if (row->y + row->height > max_y)
--- 978,998 ----
       int start, end, dy;
  {
    int min_y, max_y;
! 
    xassert (start <= end);
    xassert (start >= 0 && start < matrix->nrows);
    xassert (end >= 0 && end <= matrix->nrows);
! 
    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
! 
    for (; start < end; ++start)
      {
        struct glyph_row *row = &matrix->rows[start];
! 
        row->y += dy;
        row->visible_height = row->height;
! 
        if (row->y < min_y)
        row->visible_height -= min_y - row->y;
        if (row->y + row->height > max_y)
***************
*** 1037,1043 ****
  {
    if (f->desired_matrix)
      clear_glyph_matrix (f->desired_matrix);
!   
    if (WINDOWP (f->menu_bar_window))
      clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);
  
--- 1037,1043 ----
  {
    if (f->desired_matrix)
      clear_glyph_matrix (f->desired_matrix);
! 
    if (WINDOWP (f->menu_bar_window))
      clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);
  
***************
*** 1142,1157 ****
       int y;
  {
    int min_y, max_y;
!   
    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
!   
    clear_glyph_row (row);
    row->y = y;
    row->ascent = row->phys_ascent = 0;
    row->height = row->phys_height = CANON_Y_UNIT (XFRAME (w->frame));
    row->visible_height = row->height;
!       
    if (row->y < min_y)
      row->visible_height -= min_y - row->y;
    if (row->y + row->height > max_y)
--- 1142,1157 ----
       int y;
  {
    int min_y, max_y;
! 
    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
! 
    clear_glyph_row (row);
    row->y = y;
    row->ascent = row->phys_ascent = 0;
    row->height = row->phys_height = CANON_Y_UNIT (XFRAME (w->frame));
    row->visible_height = row->height;
! 
    if (row->y < min_y)
      row->visible_height -= min_y - row->y;
    if (row->y + row->height > max_y)
***************
*** 1290,1296 ****
    /* Copy glyphs from FROM to TO.  */
    for (area = 0; area < LAST_AREA; ++area)
      if (from->used[area])
!       bcopy (from->glyphs[area], to->glyphs[area], 
             from->used[area] * sizeof (struct glyph));
  
    /* Increment buffer positions in TO by DELTA.  */
--- 1290,1296 ----
    /* Copy glyphs from FROM to TO.  */
    for (area = 0; area < LAST_AREA; ++area)
      if (from->used[area])
!       bcopy (from->glyphs[area], to->glyphs[area],
             from->used[area] * sizeof (struct glyph));
  
    /* Increment buffer positions in TO by DELTA.  */
***************
*** 1383,1389 ****
       struct glyph_row *row;
  {
    int hash = 0;
!   
    if (row->enabled_p)
      {
        struct glyph *glyph = row->glyphs[TEXT_AREA];
--- 1383,1389 ----
       struct glyph_row *row;
  {
    int hash = 0;
! 
    if (row->enabled_p)
      {
        struct glyph *glyph = row->glyphs[TEXT_AREA];
***************
*** 1431,1437 ****
        while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))
        --end;
  
!       /* All blank line.  */      
        if (end == beg)
        return 0;
  
--- 1431,1437 ----
        while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))
        --end;
  
!       /* All blank line.  */
        if (end == beg)
        return 0;
  
***************
*** 1452,1468 ****
        while (beg < end)
        {
          GLYPH g = GLYPH_FROM_CHAR_GLYPH (*beg);
!         
          if (g < 0
              || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))
            len += 1;
          else
            len += GLYPH_LENGTH (glyph_table_base, g);
!         
          ++beg;
        }
      }
!   
    return len;
  }
  
--- 1452,1468 ----
        while (beg < end)
        {
          GLYPH g = GLYPH_FROM_CHAR_GLYPH (*beg);
! 
          if (g < 0
              || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))
            len += 1;
          else
            len += GLYPH_LENGTH (glyph_table_base, g);
! 
          ++beg;
        }
      }
! 
    return len;
  }
  
***************
*** 1473,1479 ****
     visibility.  MOUSE_FACE_P non-zero means compare the mouse_face_p
     flags of A and B, too.  */
  
! static INLINE int 
  row_equal_p (w, a, b, mouse_face_p)
       struct window *w;
       struct glyph_row *a, *b;
--- 1473,1479 ----
     visibility.  MOUSE_FACE_P non-zero means compare the mouse_face_p
     flags of A and B, too.  */
  
! static INLINE int
  row_equal_p (w, a, b, mouse_face_p)
       struct window *w;
       struct glyph_row *a, *b;
***************
*** 1496,1510 ****
        {
          if (a->used[area] != b->used[area])
            return 0;
!         
          a_glyph = a->glyphs[area];
          a_end = a_glyph + a->used[area];
          b_glyph = b->glyphs[area];
!         
          while (a_glyph < a_end
                 && GLYPH_EQUAL_P (a_glyph, b_glyph))
            ++a_glyph, ++b_glyph;
!         
          if (a_glyph != a_end)
            return 0;
        }
--- 1496,1510 ----
        {
          if (a->used[area] != b->used[area])
            return 0;
! 
          a_glyph = a->glyphs[area];
          a_end = a_glyph + a->used[area];
          b_glyph = b->glyphs[area];
! 
          while (a_glyph < a_end
                 && GLYPH_EQUAL_P (a_glyph, b_glyph))
            ++a_glyph, ++b_glyph;
! 
          if (a_glyph != a_end)
            return 0;
        }
***************
*** 1551,1560 ****
    /* Allocate a new glyph_pool and clear it.  */
    result = (struct glyph_pool *) xmalloc (sizeof *result);
    bzero (result, sizeof *result);
!   
    /* For memory leak and double deletion checking.  */
    ++glyph_pool_count;
!   
    return result;
  }
  
--- 1551,1560 ----
    /* Allocate a new glyph_pool and clear it.  */
    result = (struct glyph_pool *) xmalloc (sizeof *result);
    bzero (result, sizeof *result);
! 
    /* For memory leak and double deletion checking.  */
    ++glyph_pool_count;
! 
    return result;
  }
  
***************
*** 1626,1632 ****
       determine pointers to rows of window sub-matrices.  */
    pool->nrows = matrix_dim.height;
    pool->ncolumns = matrix_dim.width;
!   
    return changed_p;
  }
  
--- 1626,1632 ----
       determine pointers to rows of window sub-matrices.  */
    pool->nrows = matrix_dim.height;
    pool->ncolumns = matrix_dim.width;
! 
    return changed_p;
  }
  
***************
*** 1659,1665 ****
       struct glyph_matrix *matrix;
  {
    int i, j;
!   
    for (i = 0; i < matrix->nrows; ++i)
      for (j = 0; j < matrix->nrows; ++j)
        xassert (i == j
--- 1659,1665 ----
       struct glyph_matrix *matrix;
  {
    int i, j;
! 
    for (i = 0; i < matrix->nrows; ++i)
      for (j = 0; j < matrix->nrows; ++j)
        xassert (i == j
***************
*** 1684,1690 ****
  #if 0
    check_matrix_pointer_lossage (matrix);
  #endif
!   
    return matrix->rows + row;
  }
  
--- 1684,1690 ----
  #if 0
    check_matrix_pointer_lossage (matrix);
  #endif
! 
    return matrix->rows + row;
  }
  
***************
*** 1707,1713 ****
    struct buffer *saved = current_buffer;
    struct buffer *buffer = XBUFFER (w->buffer);
    int c;
!   
    /* This can sometimes happen for a fresh window.  */
    if (matrix->nrows < 2)
      return;
--- 1707,1713 ----
    struct buffer *saved = current_buffer;
    struct buffer *buffer = XBUFFER (w->buffer);
    int c;
! 
    /* This can sometimes happen for a fresh window.  */
    if (matrix->nrows < 2)
      return;
***************
*** 1870,1887 ****
         && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild));
  
    /* For WINDOW and all windows on the same level.  */
!   do 
      {
        w = XWINDOW (window);
  
        /* Get the dimension of the window sub-matrix for W, depending
         on whether this is a combination or a leaf window.  */
        if (!NILP (w->hchild))
!       dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y, 
                                                     dim_only_p,
                                                     window_change_flags);
        else if (!NILP (w->vchild))
!       dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y, 
                                                     dim_only_p,
                                                     window_change_flags);
        else
--- 1870,1887 ----
         && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild));
  
    /* For WINDOW and all windows on the same level.  */
!   do
      {
        w = XWINDOW (window);
  
        /* Get the dimension of the window sub-matrix for W, depending
         on whether this is a combination or a leaf window.  */
        if (!NILP (w->hchild))
!       dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y,
                                                     dim_only_p,
                                                     window_change_flags);
        else if (!NILP (w->vchild))
!       dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y,
                                                     dim_only_p,
                                                     window_change_flags);
        else
***************
*** 1893,1899 ****
              w->current_matrix = new_glyph_matrix (f->current_pool);
              *window_change_flags |= NEW_LEAF_MATRIX;
            }
!   
          /* Width and height MUST be chosen so that there are no
             holes in the frame matrix.  */
          dim.width = required_matrix_width (w);
--- 1893,1899 ----
              w->current_matrix = new_glyph_matrix (f->current_pool);
              *window_change_flags |= NEW_LEAF_MATRIX;
            }
! 
          /* Width and height MUST be chosen so that there are no
             holes in the frame matrix.  */
          dim.width = required_matrix_width (w);
***************
*** 1929,1935 ****
         below W.  */
        if (in_horz_combination_p)
        x += dim.width;
!       else 
          y += dim.height;
  
        /* Remember maximum glyph matrix dimensions.  */
--- 1929,1935 ----
         below W.  */
        if (in_horz_combination_p)
        x += dim.width;
!       else
          y += dim.height;
  
        /* Remember maximum glyph matrix dimensions.  */
***************
*** 1952,1958 ****
        total.width = x - x0;
        total.height = hmax;
      }
!   else 
      {
        total.width = wmax;
        total.height = y - y0;
--- 1952,1958 ----
        total.width = x - x0;
        total.height = hmax;
      }
!   else
      {
        total.width = wmax;
        total.height = y - y0;
***************
*** 1970,1976 ****
  {
  #ifdef HAVE_WINDOW_SYSTEM
    struct frame *f = XFRAME (w->frame);
!   
    if (FRAME_WINDOW_P (f))
      {
        int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f);
--- 1970,1976 ----
  {
  #ifdef HAVE_WINDOW_SYSTEM
    struct frame *f = XFRAME (w->frame);
! 
    if (FRAME_WINDOW_P (f))
      {
        int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f);
***************
*** 1984,1990 ****
              + 2);
      }
  #endif /* HAVE_WINDOW_SYSTEM */
!       
    return XINT (w->height);
  }
  
--- 1984,1990 ----
              + 2);
      }
  #endif /* HAVE_WINDOW_SYSTEM */
! 
    return XINT (w->height);
  }
  
***************
*** 2001,2007 ****
      {
        int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);
        int window_pixel_width = XFLOATINT (w->width) * CANON_X_UNIT (f);
!   
        /* Compute number of glyphs needed in a glyph row.  */
        return (((window_pixel_width + ch_width - 1)
               / ch_width)
--- 2001,2007 ----
      {
        int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);
        int window_pixel_width = XFLOATINT (w->width) * CANON_X_UNIT (f);
! 
        /* Compute number of glyphs needed in a glyph row.  */
        return (((window_pixel_width + ch_width - 1)
               / ch_width)
***************
*** 2020,2026 ****
  /* Allocate window matrices for window-based redisplay.  W is the
     window whose matrices must be allocated/reallocated.  CH_DIM is the
     size of the smallest character that could potentially be used on W.  */
!    
  static void
  allocate_matrices_for_window_redisplay (w)
       struct window *w;
--- 2020,2026 ----
  /* Allocate window matrices for window-based redisplay.  W is the
     window whose matrices must be allocated/reallocated.  CH_DIM is the
     size of the smallest character that could potentially be used on W.  */
! 
  static void
  allocate_matrices_for_window_redisplay (w)
       struct window *w;
***************
*** 2048,2054 ****
          adjust_glyph_matrix (w, w->desired_matrix, 0, 0, dim);
          adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim);
        }
!       
        w = NILP (w->next) ? NULL : XWINDOW (w->next);
      }
  }
--- 2048,2054 ----
          adjust_glyph_matrix (w, w->desired_matrix, 0, 0, dim);
          adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim);
        }
! 
        w = NILP (w->next) ? NULL : XWINDOW (w->next);
      }
  }
***************
*** 2072,2078 ****
    else
      {
        Lisp_Object tail, lisp_frame;
!       
        FOR_EACH_FRAME (tail, lisp_frame)
        adjust_frame_glyphs (XFRAME (lisp_frame));
      }
--- 2072,2078 ----
    else
      {
        Lisp_Object tail, lisp_frame;
! 
        FOR_EACH_FRAME (tail, lisp_frame)
        adjust_frame_glyphs (XFRAME (lisp_frame));
      }
***************
*** 2082,2090 ****
  
  
  /* Adjust frame glyphs when Emacs is initialized.
!    
!    To be called from init_display. 
!    
     We need a glyph matrix because redraw will happen soon.
     Unfortunately, window sizes on selected_frame are not yet set to
     meaningful values.  I believe we can assume that there are only two
--- 2082,2090 ----
  
  
  /* Adjust frame glyphs when Emacs is initialized.
! 
!    To be called from init_display.
! 
     We need a glyph matrix because redraw will happen soon.
     Unfortunately, window sizes on selected_frame are not yet set to
     meaningful values.  I believe we can assume that there are only two
***************
*** 2115,2121 ****
    adjust_frame_glyphs (sf);
    glyphs_initialized_initially_p = 1;
  }
!   
  
  /* Allocate/reallocate glyph matrices of a single frame F.  */
  
--- 2115,2121 ----
    adjust_frame_glyphs (sf);
    glyphs_initialized_initially_p = 1;
  }
! 
  
  /* Allocate/reallocate glyph matrices of a single frame F.  */
  
***************
*** 2127,2133 ****
      adjust_frame_glyphs_for_window_redisplay (f);
    else
      adjust_frame_glyphs_for_frame_redisplay (f);
!   
    /* Don't forget the message buffer and the buffer for
       decode_mode_spec.  */
    adjust_frame_message_buffer (f);
--- 2127,2133 ----
      adjust_frame_glyphs_for_window_redisplay (f);
    else
      adjust_frame_glyphs_for_frame_redisplay (f);
! 
    /* Don't forget the message buffer and the buffer for
       decode_mode_spec.  */
    adjust_frame_message_buffer (f);
***************
*** 2145,2155 ****
       Lisp_Object window;
  {
    struct window *w;
!       
    for (; !NILP (window); window = w->next)
      {
        w = XWINDOW (window);
!       
        if (!NILP (w->hchild))
        fake_current_matrices (w->hchild);
        else if (!NILP (w->vchild))
--- 2145,2155 ----
       Lisp_Object window;
  {
    struct window *w;
! 
    for (; !NILP (window); window = w->next)
      {
        w = XWINDOW (window);
! 
        if (!NILP (w->hchild))
        fake_current_matrices (w->hchild);
        else if (!NILP (w->vchild))
***************
*** 2163,2169 ****
  
          xassert (m->matrix_h == XFASTINT (w->height));
          xassert (m->matrix_w == XFASTINT (w->width));
!         
          for (i = 0; i < m->matrix_h; ++i)
            {
              struct glyph_row *r = m->rows + i;
--- 2163,2169 ----
  
          xassert (m->matrix_h == XFASTINT (w->height));
          xassert (m->matrix_w == XFASTINT (w->width));
! 
          for (i = 0; i < m->matrix_h; ++i)
            {
              struct glyph_row *r = m->rows + i;
***************
*** 2238,2244 ****
        to->used[TEXT_AREA] = from->used[TEXT_AREA];
        xfree (from->glyphs[TEXT_AREA]);
      }
!   
    xfree (saved->rows);
    xfree (saved);
  }
--- 2238,2244 ----
        to->used[TEXT_AREA] = from->used[TEXT_AREA];
        xfree (from->glyphs[TEXT_AREA]);
      }
! 
    xfree (saved->rows);
    xfree (saved);
  }
***************
*** 2264,2270 ****
    /* Determine the smallest character in any font for F.  On
       console windows, all characters have dimension (1, 1).  */
    ch_dim.width = ch_dim.height = 1;
!   
    top_window_y = FRAME_TOP_MARGIN (f);
  
    /* Allocate glyph pool structures if not already done.  */
--- 2264,2270 ----
    /* Determine the smallest character in any font for F.  On
       console windows, all characters have dimension (1, 1).  */
    ch_dim.width = ch_dim.height = 1;
! 
    top_window_y = FRAME_TOP_MARGIN (f);
  
    /* Allocate glyph pool structures if not already done.  */
***************
*** 2280,2286 ****
        f->desired_matrix = new_glyph_matrix (f->desired_pool);
        f->current_matrix = new_glyph_matrix (f->current_pool);
      }
!   
    /* Compute window glyph matrices.  (This takes the mini-buffer
       window into account).  The result is the size of the frame glyph
       matrix needed.  The variable window_change_flags is set to a bit
--- 2280,2286 ----
        f->desired_matrix = new_glyph_matrix (f->desired_pool);
        f->current_matrix = new_glyph_matrix (f->current_pool);
      }
! 
    /* Compute window glyph matrices.  (This takes the mini-buffer
       window into account).  The result is the size of the frame glyph
       matrix needed.  The variable window_change_flags is set to a bit
***************
*** 2301,2307 ****
    pool_changed_p = realloc_glyph_pool (f->desired_pool, matrix_dim);
    realloc_glyph_pool (f->current_pool, matrix_dim);
  
!   /* Set up glyph pointers within window matrices.  Do this only if 
       absolutely necessary since it requires a frame redraw.  */
    if (pool_changed_p || window_change_flags)
      {
--- 2301,2307 ----
    pool_changed_p = realloc_glyph_pool (f->desired_pool, matrix_dim);
    realloc_glyph_pool (f->current_pool, matrix_dim);
  
!   /* Set up glyph pointers within window matrices.  Do this only if
       absolutely necessary since it requires a frame redraw.  */
    if (pool_changed_p || window_change_flags)
      {
***************
*** 2315,2321 ****
         to the frame width (from CHANGE_FRAME_SIZE_1).  */
        xassert (matrix_dim.width == FRAME_WIDTH (f)
               && matrix_dim.height == FRAME_HEIGHT (f));
!   
        /* Pointers to glyph memory in glyph rows are exchanged during
         the update phase of redisplay, which means in general that a
         frame's current matrix consists of pointers into both the
--- 2315,2321 ----
         to the frame width (from CHANGE_FRAME_SIZE_1).  */
        xassert (matrix_dim.width == FRAME_WIDTH (f)
               && matrix_dim.height == FRAME_HEIGHT (f));
! 
        /* Pointers to glyph memory in glyph rows are exchanged during
         the update phase of redisplay, which means in general that a
         frame's current matrix consists of pointers into both the
***************
*** 2357,2363 ****
    struct window *w;
  
    xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));
!   
    /* Get minimum sizes.  */
  #ifdef HAVE_WINDOW_SYSTEM
    ch_dim.width = FRAME_SMALLEST_CHAR_WIDTH (f);
--- 2357,2363 ----
    struct window *w;
  
    xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));
! 
    /* Get minimum sizes.  */
  #ifdef HAVE_WINDOW_SYSTEM
    ch_dim.width = FRAME_SMALLEST_CHAR_WIDTH (f);
***************
*** 2365,2371 ****
  #else
    ch_dim.width = ch_dim.height = 1;
  #endif
!     
    /* Allocate/reallocate window matrices.  */
    allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f)));
  
--- 2365,2371 ----
  #else
    ch_dim.width = ch_dim.height = 1;
  #endif
! 
    /* Allocate/reallocate window matrices.  */
    allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f)));
  
***************
*** 2416,2422 ****
  }
  
  
! /* Adjust/ allocate message buffer of frame F. 
  
     Note that the message buffer is never freed.  Since I could not
     find a free in 19.34, I assume that freeing it would be
--- 2416,2422 ----
  }
  
  
! /* Adjust/ allocate message buffer of frame F.
  
     Note that the message buffer is never freed.  Since I could not
     find a free in 19.34, I assume that freeing it would be
***************
*** 2474,2480 ****
           event while we're in an inconsistent state.  */
        BLOCK_INPUT;
        f->glyphs_initialized_p = 0;
!       
        /* Release window sub-matrices.  */
        if (!NILP (f->root_window))
          free_window_matrices (XWINDOW (f->root_window));
--- 2474,2480 ----
           event while we're in an inconsistent state.  */
        BLOCK_INPUT;
        f->glyphs_initialized_p = 0;
! 
        /* Release window sub-matrices.  */
        if (!NILP (f->root_window))
          free_window_matrices (XWINDOW (f->root_window));
***************
*** 2516,2522 ****
          free_glyph_pool (f->current_pool);
          f->desired_pool = f->current_pool = NULL;
        }
!       
        UNBLOCK_INPUT;
      }
  }
--- 2516,2522 ----
          free_glyph_pool (f->current_pool);
          f->desired_pool = f->current_pool = NULL;
        }
! 
        UNBLOCK_INPUT;
      }
  }
***************
*** 2536,2542 ****
        free_window_matrices (XWINDOW (w->hchild));
        else if (!NILP (w->vchild))
        free_window_matrices (XWINDOW (w->vchild));
!       else 
        {
          /* This is a leaf window.  Free its memory and reset fields
             to zero in case this function is called a second time for
--- 2536,2542 ----
        free_window_matrices (XWINDOW (w->hchild));
        else if (!NILP (w->vchild))
        free_window_matrices (XWINDOW (w->vchild));
!       else
        {
          /* This is a leaf window.  Free its memory and reset fields
             to zero in case this function is called a second time for
***************
*** 2611,2617 ****
     up glyph lengths of the window matrices.  A line in the frame
     matrix is enabled, if a corresponding line in a window matrix is
     enabled.
!    
     After building the desired frame matrix, it will be passed to
     terminal code, which will manipulate both the desired and current
     frame matrix.  Changes applied to the frame's current matrix have
--- 2611,2617 ----
     up glyph lengths of the window matrices.  A line in the frame
     matrix is enabled, if a corresponding line in a window matrix is
     enabled.
! 
     After building the desired frame matrix, it will be passed to
     terminal code, which will manipulate both the desired and current
     frame matrix.  Changes applied to the frame's current matrix have
***************
*** 2624,2630 ****
     contents needed in a frame matrix.  Thus, any modification of
     glyphs done in terminal code will be reflected in window matrices
     automatically.
!    
     2. Exchanges of rows in a frame matrix done by terminal code are
     intercepted by hook functions so that corresponding row operations
     on window matrices can be performed.  This is necessary because we
--- 2624,2630 ----
     contents needed in a frame matrix.  Thus, any modification of
     glyphs done in terminal code will be reflected in window matrices
     automatically.
! 
     2. Exchanges of rows in a frame matrix done by terminal code are
     intercepted by hook functions so that corresponding row operations
     on window matrices can be performed.  This is necessary because we
***************
*** 2649,2655 ****
  
    /* F must have a frame matrix when this function is called.  */
    xassert (!FRAME_WINDOW_P (f));
!   
    /* Clear all rows in the frame matrix covered by window matrices.
       Menu bar lines are not covered by windows.  */
    for (i = FRAME_TOP_MARGIN (f); i < f->desired_matrix->nrows; ++i)
--- 2649,2655 ----
  
    /* F must have a frame matrix when this function is called.  */
    xassert (!FRAME_WINDOW_P (f));
! 
    /* Clear all rows in the frame matrix covered by window matrices.
       Menu bar lines are not covered by windows.  */
    for (i = FRAME_TOP_MARGIN (f); i < f->desired_matrix->nrows; ++i)
***************
*** 2747,2753 ****
          window_row = w->current_matrix->rows + window_y;
          current_row_p = 1;
        }
!       
        if (current_row_p)
        {
          /* Copy window row to frame row.  */
--- 2747,2753 ----
          window_row = w->current_matrix->rows + window_y;
          current_row_p = 1;
        }
! 
        if (current_row_p)
        {
          /* Copy window row to frame row.  */
***************
*** 2758,2768 ****
        else
        {
          xassert (window_row->enabled_p);
!         
          /* Only when a desired row has been displayed, we want
             the corresponding frame row to be updated.  */
          frame_row->enabled_p = 1;
!         
            /* Maybe insert a vertical border between horizontally adjacent
             windows.  */
            if (right_border_glyph)
--- 2758,2768 ----
        else
        {
          xassert (window_row->enabled_p);
! 
          /* Only when a desired row has been displayed, we want
             the corresponding frame row to be updated.  */
          frame_row->enabled_p = 1;
! 
            /* Maybe insert a vertical border between horizontally adjacent
             windows.  */
            if (right_border_glyph)
***************
*** 2774,2783 ****
          /* Window row window_y must be a slice of frame row
             frame_y.  */
          xassert (glyph_row_slice_p (window_row, frame_row));
!         
          /* If rows are in sync, we don't have to copy glyphs because
             frame and window share glyphs.  */
!         
  #if GLYPH_DEBUG
          strcpy (w->current_matrix->method, w->desired_matrix->method);
          add_window_display_history (w, w->current_matrix->method, 0);
--- 2774,2783 ----
          /* Window row window_y must be a slice of frame row
             frame_y.  */
          xassert (glyph_row_slice_p (window_row, frame_row));
! 
          /* If rows are in sync, we don't have to copy glyphs because
             frame and window share glyphs.  */
! 
  #if GLYPH_DEBUG
          strcpy (w->current_matrix->method, w->desired_matrix->method);
          add_window_display_history (w, w->current_matrix->method, 0);
***************
*** 2787,2793 ****
        /* Set number of used glyphs in the frame matrix.  Since we fill
           up with spaces, and visit leaf windows from left to right it
           can be done simply.  */
!       frame_row->used[TEXT_AREA] 
        = window_matrix->matrix_x + window_matrix->matrix_w;
  
        /* Next row.  */
--- 2787,2793 ----
        /* Set number of used glyphs in the frame matrix.  Since we fill
           up with spaces, and visit leaf windows from left to right it
           can be done simply.  */
!       frame_row->used[TEXT_AREA]
        = window_matrix->matrix_x + window_matrix->matrix_w;
  
        /* Next row.  */
***************
*** 2853,2859 ****
  {
    int i = row->used[TEXT_AREA];
    struct glyph *glyph = row->glyphs[TEXT_AREA];
!   
    while (i < upto)
      glyph[i++] = space_glyph;
  
--- 2853,2859 ----
  {
    int i = row->used[TEXT_AREA];
    struct glyph *glyph = row->glyphs[TEXT_AREA];
! 
    while (i < upto)
      glyph[i++] = space_glyph;
  
***************
*** 2949,2955 ****
              current_row->enabled_p = 1;
            }
        }
!       
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
  }
--- 2949,2955 ----
              current_row->enabled_p = 1;
            }
        }
! 
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
  }
***************
*** 2964,2970 ****
     row 0 <= I < NLINES which is empty.
  
     This function is called from do_scrolling and do_direct_scrolling.  */
!    
  void
  mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
                     retained_p)
--- 2964,2970 ----
     row 0 <= I < NLINES which is empty.
  
     This function is called from do_scrolling and do_direct_scrolling.  */
! 
  void
  mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
                     retained_p)
***************
*** 2978,2984 ****
  
    /* Rows to assign to.  */
    struct glyph_row *new_rows = MATRIX_ROW (matrix, unchanged_at_top);
!   
    int i;
  
    /* Make a copy of the original rows.  */
--- 2978,2984 ----
  
    /* Rows to assign to.  */
    struct glyph_row *new_rows = MATRIX_ROW (matrix, unchanged_at_top);
! 
    int i;
  
    /* Make a copy of the original rows.  */
***************
*** 3030,3036 ****
    window_row = w->current_matrix->rows;
    window_row_end = window_row + w->current_matrix->nrows;
    frame_row = f->current_matrix->rows + XFASTINT (w->top);
!   
    for (; window_row < window_row_end; ++window_row, ++frame_row)
      {
        window_row->glyphs[LEFT_MARGIN_AREA]
--- 3030,3036 ----
    window_row = w->current_matrix->rows;
    window_row_end = window_row + w->current_matrix->nrows;
    frame_row = f->current_matrix->rows + XFASTINT (w->top);
! 
    for (; window_row < window_row_end; ++window_row, ++frame_row)
      {
        window_row->glyphs[LEFT_MARGIN_AREA]
***************
*** 3054,3060 ****
       int row;
  {
    struct window *found = NULL;
!   
    while (w && !found)
      {
        if (!NILP (w->hchild))
--- 3054,3060 ----
       int row;
  {
    struct window *found = NULL;
! 
    while (w && !found)
      {
        if (!NILP (w->hchild))
***************
*** 3064,3070 ****
        else if (row >= XFASTINT (w->top)
               && row < XFASTINT (w->top) + XFASTINT (w->height))
        found = w;
!       
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
  
--- 3064,3070 ----
        else if (row >= XFASTINT (w->top)
               && row < XFASTINT (w->top) + XFASTINT (w->height))
        found = w;
! 
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
  
***************
*** 3114,3149 ****
            {
              /* Frame relative line assigned to.  */
              int frame_to = i + unchanged_at_top;
!             
              /* Frame relative line assigned.  */
              int frame_from = copy_from[i] + unchanged_at_top;
!             
              /* Window relative line assigned to.  */
              int window_to = frame_to - m->matrix_y;
!             
              /* Window relative line assigned.  */
              int window_from = frame_from - m->matrix_y;
!             
              /* Is assigned line inside window?  */
              int from_inside_window_p
                = window_from >= 0 && window_from < m->matrix_h;
!             
              /* Is assigned to line inside window?  */
              int to_inside_window_p
                = window_to >= 0 && window_to < m->matrix_h;
!             
              if (from_inside_window_p && to_inside_window_p)
                {
                  /* Enabled setting before assignment.  */
                  int enabled_before_p;
!                 
                  /* Do the assignment.  The enabled_p flag is saved
                     over the assignment because the old redisplay did
                     that.  */
                  enabled_before_p = m->rows[window_to].enabled_p;
                  m->rows[window_to] = old_rows[window_from];
                  m->rows[window_to].enabled_p = enabled_before_p;
!                 
                  /* If frame line is empty, window line is empty, too.  */
                  if (!retained_p[copy_from[i]])
                    m->rows[window_to].enabled_p = 0;
--- 3114,3149 ----
            {
              /* Frame relative line assigned to.  */
              int frame_to = i + unchanged_at_top;
! 
              /* Frame relative line assigned.  */
              int frame_from = copy_from[i] + unchanged_at_top;
! 
              /* Window relative line assigned to.  */
              int window_to = frame_to - m->matrix_y;
! 
              /* Window relative line assigned.  */
              int window_from = frame_from - m->matrix_y;
! 
              /* Is assigned line inside window?  */
              int from_inside_window_p
                = window_from >= 0 && window_from < m->matrix_h;
! 
              /* Is assigned to line inside window?  */
              int to_inside_window_p
                = window_to >= 0 && window_to < m->matrix_h;
! 
              if (from_inside_window_p && to_inside_window_p)
                {
                  /* Enabled setting before assignment.  */
                  int enabled_before_p;
! 
                  /* Do the assignment.  The enabled_p flag is saved
                     over the assignment because the old redisplay did
                     that.  */
                  enabled_before_p = m->rows[window_to].enabled_p;
                  m->rows[window_to] = old_rows[window_from];
                  m->rows[window_to].enabled_p = enabled_before_p;
! 
                  /* If frame line is empty, window line is empty, too.  */
                  if (!retained_p[copy_from[i]])
                    m->rows[window_to].enabled_p = 0;
***************
*** 3163,3169 ****
                  m2_from = frame_from - m2->matrix_y;
                  copy_row_except_pointers (m->rows + window_to,
                                            m2->rows + m2_from);
!                 
                  /* If frame line is empty, window line is empty, too.  */
                  if (!retained_p[copy_from[i]])
                    m->rows[window_to].enabled_p = 0;
--- 3163,3169 ----
                  m2_from = frame_from - m2->matrix_y;
                  copy_row_except_pointers (m->rows + window_to,
                                            m2->rows + m2_from);
! 
                  /* If frame line is empty, window line is empty, too.  */
                  if (!retained_p[copy_from[i]])
                    m->rows[window_to].enabled_p = 0;
***************
*** 3177,3183 ****
             pointers are in sync with the frame matrix.  */
          if (sync_p)
            sync_window_with_frame_matrix_rows (w);
!         
          /* Check that no pointers are lost.  */
          CHECK_MATRIX (m);
        }
--- 3177,3183 ----
             pointers are in sync with the frame matrix.  */
          if (sync_p)
            sync_window_with_frame_matrix_rows (w);
! 
          /* Check that no pointers are lost.  */
          CHECK_MATRIX (m);
        }
***************
*** 3212,3218 ****
          check_matrix_pointers (w->desired_matrix, f->desired_matrix);
          check_matrix_pointers (w->current_matrix, f->current_matrix);
        }
!       
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
  }
--- 3212,3218 ----
          check_matrix_pointers (w->desired_matrix, f->desired_matrix);
          check_matrix_pointers (w->current_matrix, f->current_matrix);
        }
! 
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
  }
***************
*** 3233,3239 ****
    /* Row number corresponding to I in FRAME_MATRIX.  */
    int j = window_matrix->matrix_y;
  
!   /* For all rows check that the row in the window matrix is a 
       slice of the row in the frame matrix.  If it isn't we didn't
       mirror an operation on the frame matrix correctly.  */
    while (i < window_matrix->nrows)
--- 3233,3239 ----
    /* Row number corresponding to I in FRAME_MATRIX.  */
    int j = window_matrix->matrix_y;
  
!   /* For all rows check that the row in the window matrix is a
       slice of the row in the frame matrix.  If it isn't we didn't
       mirror an operation on the frame matrix correctly.  */
    while (i < window_matrix->nrows)
***************
*** 3264,3270 ****
       int vpos;
  {
    struct frame *f = XFRAME (w->frame);
!   
    xassert (!FRAME_WINDOW_P (f));
    xassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
    vpos += XFASTINT (w->top);
--- 3264,3270 ----
       int vpos;
  {
    struct frame *f = XFRAME (w->frame);
! 
    xassert (!FRAME_WINDOW_P (f));
    xassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
    vpos += XFASTINT (w->top);
***************
*** 3282,3293 ****
       int hpos;
  {
    struct frame *f = XFRAME (w->frame);
!   
    xassert (!FRAME_WINDOW_P (f));
    hpos += XFASTINT (w->left);
    return hpos;
  }
!   
  #endif /* GLYPH_DEBUG */
  
  
--- 3282,3293 ----
       int hpos;
  {
    struct frame *f = XFRAME (w->frame);
! 
    xassert (!FRAME_WINDOW_P (f));
    hpos += XFASTINT (w->left);
    return hpos;
  }
! 
  #endif /* GLYPH_DEBUG */
  
  
***************
*** 3429,3436 ****
         is handled specially there (see display_line).  */
        || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))
        /* Give up if overwriting in the middle of a line.  */
!       || (overwrite_p 
!         && PT != ZV 
          && FETCH_BYTE (PT) != '\n')
        /* Give up for tabs and line ends.  */
        || g == '\t'
--- 3429,3436 ----
         is handled specially there (see display_line).  */
        || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))
        /* Give up if overwriting in the middle of a line.  */
!       || (overwrite_p
!         && PT != ZV
          && FETCH_BYTE (PT) != '\n')
        /* Give up for tabs and line ends.  */
        || g == '\t'
***************
*** 3474,3480 ****
    glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
    if (glyph_row->mouse_face_p)
      return 0;
!   
    /* Give up if highlighting trailing whitespace and we have trailing
       whitespace in glyph_row.  We would have to remove the trailing
       whitespace face in that case.  */
--- 3474,3480 ----
    glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
    if (glyph_row->mouse_face_p)
      return 0;
! 
    /* Give up if highlighting trailing whitespace and we have trailing
       whitespace in glyph_row.  We would have to remove the trailing
       whitespace face in that case.  */
***************
*** 3494,3500 ****
       if the overlay string has newlines in it.  */
    if (STRINGP (it.string))
      return 0;
!   
    it.hpos = w->cursor.hpos;
    it.vpos = w->cursor.vpos;
    it.current_x = w->cursor.x + it.first_visible_x;
--- 3494,3500 ----
       if the overlay string has newlines in it.  */
    if (STRINGP (it.string))
      return 0;
! 
    it.hpos = w->cursor.hpos;
    it.vpos = w->cursor.vpos;
    it.current_x = w->cursor.x + it.first_visible_x;
***************
*** 3505,3511 ****
  
    /* More than one display element may be returned for PT - 1 if
       (i) it's a control character which is translated into `\003' or
!      `^C', or (ii) it has a display table entry, or (iii) it's a 
       combination of both.  */
    delta = delta_bytes = 0;
    while (get_next_display_element (&it))
--- 3505,3511 ----
  
    /* More than one display element may be returned for PT - 1 if
       (i) it's a control character which is translated into `\003' or
!      `^C', or (ii) it has a display table entry, or (iii) it's a
       combination of both.  */
    delta = delta_bytes = 0;
    while (get_next_display_element (&it))
***************
*** 3562,3568 ****
    bcopy (it.glyph_row->glyphs[TEXT_AREA], glyphs, n * sizeof *glyphs);
    glyph_row->used[TEXT_AREA] = min (glyph_row->used[TEXT_AREA] + n,
                                    end - glyph_row->glyphs[TEXT_AREA]);
!   
    /* Compute new line width.  */
    glyph = glyph_row->glyphs[TEXT_AREA];
    end = glyph + glyph_row->used[TEXT_AREA];
--- 3562,3568 ----
    bcopy (it.glyph_row->glyphs[TEXT_AREA], glyphs, n * sizeof *glyphs);
    glyph_row->used[TEXT_AREA] = min (glyph_row->used[TEXT_AREA] + n,
                                    end - glyph_row->glyphs[TEXT_AREA]);
! 
    /* Compute new line width.  */
    glyph = glyph_row->glyphs[TEXT_AREA];
    end = glyph + glyph_row->used[TEXT_AREA];
***************
*** 3573,3590 ****
        ++glyph;
      }
  
!   /* Increment buffer positions for glyphs following the newly 
       inserted ones.  */
    for (glyph = glyphs + n; glyph < end; ++glyph)
      if (glyph->charpos > 0 && BUFFERP (glyph->object))
        glyph->charpos += delta;
!   
    if (MATRIX_ROW_END_CHARPOS (glyph_row) > 0)
      {
        MATRIX_ROW_END_CHARPOS (glyph_row) += delta;
        MATRIX_ROW_END_BYTEPOS (glyph_row) += delta_bytes;
      }
!       
    /* Adjust positions in lines following the one we are in.  */
    increment_matrix_positions (w->current_matrix,
                              w->cursor.vpos + 1,
--- 3573,3590 ----
        ++glyph;
      }
  
!   /* Increment buffer positions for glyphs following the newly
       inserted ones.  */
    for (glyph = glyphs + n; glyph < end; ++glyph)
      if (glyph->charpos > 0 && BUFFERP (glyph->object))
        glyph->charpos += delta;
! 
    if (MATRIX_ROW_END_CHARPOS (glyph_row) > 0)
      {
        MATRIX_ROW_END_CHARPOS (glyph_row) += delta;
        MATRIX_ROW_END_BYTEPOS (glyph_row) += delta_bytes;
      }
! 
    /* Adjust positions in lines following the one we are in.  */
    increment_matrix_positions (w->current_matrix,
                              w->cursor.vpos + 1,
***************
*** 3611,3617 ****
    if (rif)
      {
        rif->update_window_begin_hook (w);
!       
        if (glyphs == end - n
          /* In front of a space added by append_space.  */
          || (glyphs == end - n - 1
--- 3611,3617 ----
    if (rif)
      {
        rif->update_window_begin_hook (w);
! 
        if (glyphs == end - n
          /* In front of a space added by append_space.  */
          || (glyphs == end - n - 1
***************
*** 3684,3691 ****
    /* Give up if face attributes have been changed.  */
    if (face_change_count)
      return 0;
!   
!   /* Give up if current matrix is not up to date or we are 
       displaying a message.  */
    if (!display_completed || cursor_in_echo_area)
      return 0;
--- 3684,3691 ----
    /* Give up if face attributes have been changed.  */
    if (face_change_count)
      return 0;
! 
!   /* Give up if current matrix is not up to date or we are
       displaying a message.  */
    if (!display_completed || cursor_in_echo_area)
      return 0;
***************
*** 3712,3718 ****
    if (XWINDOW (minibuf_window) == w
        && EQ (minibuf_window, echo_area_window))
      return 0;
!   
    /* Give up if we don't know where the cursor is.  */
    if (w->cursor.vpos < 0)
      return 0;
--- 3712,3718 ----
    if (XWINDOW (minibuf_window) == w
        && EQ (minibuf_window, echo_area_window))
      return 0;
! 
    /* Give up if we don't know where the cursor is.  */
    if (w->cursor.vpos < 0)
      return 0;
***************
*** 3725,3737 ****
      return 0;
  
    set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
!   
    w->last_cursor = w->cursor;
    XSETFASTINT (w->last_point, PT);
  
    xassert (w->cursor.hpos >= 0
           && w->cursor.hpos < w->desired_matrix->matrix_w);
!   
    if (FRAME_WINDOW_P (f))
      rif->cursor_to (w->cursor.vpos, w->cursor.hpos,
                    w->cursor.y, w->cursor.x);
--- 3725,3737 ----
      return 0;
  
    set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
! 
    w->last_cursor = w->cursor;
    XSETFASTINT (w->last_point, PT);
  
    xassert (w->cursor.hpos >= 0
           && w->cursor.hpos < w->desired_matrix->matrix_w);
! 
    if (FRAME_WINDOW_P (f))
      rif->cursor_to (w->cursor.vpos, w->cursor.hpos,
                    w->cursor.y, w->cursor.x);
***************
*** 3745,3751 ****
        y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
        cursor_to (y, x);
      }
!   
    fflush (stdout);
    redisplay_performed_directly_p = 1;
    return 1;
--- 3745,3751 ----
        y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
        cursor_to (y, x);
      }
! 
    fflush (stdout);
    redisplay_performed_directly_p = 1;
    return 1;
***************
*** 3762,3768 ****
     If FORCE_P is non-zero, don't let redisplay be stopped by detecting
     pending input.  If INHIBIT_HAIRY_ID_P is non-zero, don't try
     scrolling.
!    
     Value is non-zero if redisplay was stopped due to pending input.  */
  
  int
--- 3762,3768 ----
     If FORCE_P is non-zero, don't let redisplay be stopped by detecting
     pending input.  If INHIBIT_HAIRY_ID_P is non-zero, don't try
     scrolling.
! 
     Value is non-zero if redisplay was stopped due to pending input.  */
  
  int
***************
*** 3812,3823 ****
              f->desired_tool_bar_string = tem;
            }
        }
!   
  
        /* Update windows.  */
        paused_p = update_window_tree (root_window, force_p);
        update_end (f);
!       
  #if 0 /* This flush is a performance bottleneck under X,
         and it doesn't seem to be necessary anyway.  */
        rif->flush_display (f);
--- 3812,3823 ----
              f->desired_tool_bar_string = tem;
            }
        }
! 
  
        /* Update windows.  */
        paused_p = update_window_tree (root_window, force_p);
        update_end (f);
! 
  #if 0 /* This flush is a performance bottleneck under X,
         and it doesn't seem to be necessary anyway.  */
        rif->flush_display (f);
***************
*** 3831,3837 ****
  
        /* Build F's desired matrix from window matrices.  */
        build_frame_matrix (f);
!       
        /* Update the display  */
        update_begin (f);
        paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
--- 3831,3837 ----
  
        /* Build F's desired matrix from window matrices.  */
        build_frame_matrix (f);
! 
        /* Update the display  */
        update_begin (f);
        paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
***************
*** 3850,3856 ****
  
    /* Reset flags indicating that a window should be updated.  */
    set_window_update_flags (root_window, 0);
!   
    display_completed = !paused_p;
    return paused_p;
  }
--- 3850,3856 ----
  
    /* Reset flags indicating that a window should be updated.  */
    set_window_update_flags (root_window, 0);
! 
    display_completed = !paused_p;
    return paused_p;
  }
***************
*** 3870,3876 ****
       int force_p;
  {
    int paused_p = 0;
!   
    while (w && !paused_p)
      {
        if (!NILP (w->hchild))
--- 3870,3876 ----
       int force_p;
  {
    int paused_p = 0;
! 
    while (w && !paused_p)
      {
        if (!NILP (w->hchild))
***************
*** 3922,3928 ****
       int yb;
  {
    int i;
!   
    /* If rows overlapping others have been changed, the rows being
       overlapped have to be redrawn.  This won't draw lines that have
       already been drawn in update_window_line because overlapped_p in
--- 3922,3928 ----
       int yb;
  {
    int i;
! 
    /* If rows overlapping others have been changed, the rows being
       overlapped have to be redrawn.  This won't draw lines that have
       already been drawn in update_window_line because overlapped_p in
***************
*** 3936,3946 ****
        break;
        else if (row->mode_line_p)
        continue;
!       
        if (row->overlapped_p)
        {
          enum glyph_row_area area;
!         
          for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
            {
              updated_row = row;
--- 3936,3946 ----
        break;
        else if (row->mode_line_p)
        continue;
! 
        if (row->overlapped_p)
        {
          enum glyph_row_area area;
! 
          for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
            {
              updated_row = row;
***************
*** 3950,3956 ****
                rif->write_glyphs (row->glyphs[area], row->used[area]);
              rif->clear_end_of_line (-1);
            }
!         
          row->overlapped_p = 0;
        }
  
--- 3950,3956 ----
                rif->write_glyphs (row->glyphs[area], row->used[area]);
              rif->clear_end_of_line (-1);
            }
! 
          row->overlapped_p = 0;
        }
  
***************
*** 3970,3976 ****
  {
    int i, bottom_y;
    struct glyph_row *row;
!   
    for (i = 0; i < w->current_matrix->nrows; ++i)
      {
        row = w->current_matrix->rows + i;
--- 3970,3976 ----
  {
    int i, bottom_y;
    struct glyph_row *row;
! 
    for (i = 0; i < w->current_matrix->nrows; ++i)
      {
        row = w->current_matrix->rows + i;
***************
*** 3979,3995 ****
        break;
        else if (row->mode_line_p)
        continue;
!       
        bottom_y = MATRIX_ROW_BOTTOM_Y (row);
  
        if (row->overlapping_p && i > 0 && bottom_y < yb)
        {
          if (row->used[LEFT_MARGIN_AREA])
            rif->fix_overlapping_area (w, row, LEFT_MARGIN_AREA);
!   
          if (row->used[TEXT_AREA])
            rif->fix_overlapping_area (w, row, TEXT_AREA);
!   
          if (row->used[RIGHT_MARGIN_AREA])
            rif->fix_overlapping_area (w, row, RIGHT_MARGIN_AREA);
  
--- 3979,3995 ----
        break;
        else if (row->mode_line_p)
        continue;
! 
        bottom_y = MATRIX_ROW_BOTTOM_Y (row);
  
        if (row->overlapping_p && i > 0 && bottom_y < yb)
        {
          if (row->used[LEFT_MARGIN_AREA])
            rif->fix_overlapping_area (w, row, LEFT_MARGIN_AREA);
! 
          if (row->used[TEXT_AREA])
            rif->fix_overlapping_area (w, row, TEXT_AREA);
! 
          if (row->used[RIGHT_MARGIN_AREA])
            rif->fix_overlapping_area (w, row, RIGHT_MARGIN_AREA);
  
***************
*** 4078,4084 ****
         Adjust y-positions of other rows by the header line height.  */
        row = desired_matrix->rows;
        end = row + desired_matrix->nrows - 1;
!       
        if (row->mode_line_p)
        {
          header_line_row = row;
--- 4078,4084 ----
         Adjust y-positions of other rows by the header line height.  */
        row = desired_matrix->rows;
        end = row + desired_matrix->nrows - 1;
! 
        if (row->mode_line_p)
        {
          header_line_row = row;
***************
*** 4103,4109 ****
         be also completely empty matrices.  */
        while (row < end && !row->enabled_p)
        ++row;
!       
        /* Try reusing part of the display by copying.  */
        if (row < end && !desired_matrix->no_scrolling_p)
        {
--- 4103,4109 ----
         be also completely empty matrices.  */
        while (row < end && !row->enabled_p)
        ++row;
! 
        /* Try reusing part of the display by copying.  */
        if (row < end && !desired_matrix->no_scrolling_p)
        {
***************
*** 4136,4142 ****
          {
            int vpos = MATRIX_ROW_VPOS (row, desired_matrix);
            int i;
!           
            /* We'll have to play a little bit with when to
               detect_input_pending.  If it's done too often,
               scrolling large windows with repeated scroll-up
--- 4136,4142 ----
          {
            int vpos = MATRIX_ROW_VPOS (row, desired_matrix);
            int i;
! 
            /* We'll have to play a little bit with when to
               detect_input_pending.  If it's done too often,
               scrolling large windows with repeated scroll-up
***************
*** 4163,4171 ****
  
        /* Was display preempted?  */
        paused_p = row < end;
!       
      set_cursor:
!       
        /* Fix the appearance of overlapping/overlapped rows.  */
        if (!paused_p && !w->pseudo_window_p)
        {
--- 4163,4171 ----
  
        /* Was display preempted?  */
        paused_p = row < end;
! 
      set_cursor:
! 
        /* Fix the appearance of overlapping/overlapped rows.  */
        if (!paused_p && !w->pseudo_window_p)
        {
***************
*** 4174,4180 ****
              redraw_overlapped_rows (w, yb);
              redraw_overlapping_rows (w, yb);
            }
!       
          /* Make cursor visible at cursor position of W.  */
          set_window_cursor_after_update (w);
  
--- 4174,4180 ----
              redraw_overlapped_rows (w, yb);
              redraw_overlapping_rows (w, yb);
            }
! 
          /* Make cursor visible at cursor position of W.  */
          set_window_cursor_after_update (w);
  
***************
*** 4202,4208 ****
    /* check_current_matrix_flags (w); */
    add_window_display_history (w, w->current_matrix->method, paused_p);
  #endif
!   
    clear_glyph_matrix (desired_matrix);
  
    return paused_p;
--- 4202,4208 ----
    /* check_current_matrix_flags (w); */
    add_window_display_history (w, w->current_matrix->method, paused_p);
  #endif
! 
    clear_glyph_matrix (desired_matrix);
  
    return paused_p;
***************
*** 4248,4254 ****
    /* Let functions in xterm.c know what area subsequent X positions
       will be relative to.  */
    updated_area = TEXT_AREA;
!   
    /* If rows are at different X or Y, or rows have different height,
       or the current row is marked invalid, write the entire line.  */
    if (!current_row->enabled_p
--- 4248,4254 ----
    /* Let functions in xterm.c know what area subsequent X positions
       will be relative to.  */
    updated_area = TEXT_AREA;
! 
    /* If rows are at different X or Y, or rows have different height,
       or the current row is marked invalid, write the entire line.  */
    if (!current_row->enabled_p
***************
*** 4262,4272 ****
        || current_row->x != desired_row->x)
      {
        rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);
!       
        if (desired_row->used[TEXT_AREA])
        rif->write_glyphs (desired_row->glyphs[TEXT_AREA],
                           desired_row->used[TEXT_AREA]);
!       
        /* Clear to end of window.  */
        rif->clear_end_of_line (-1);
        changed_p = 1;
--- 4262,4272 ----
        || current_row->x != desired_row->x)
      {
        rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);
! 
        if (desired_row->used[TEXT_AREA])
        rif->write_glyphs (desired_row->glyphs[TEXT_AREA],
                           desired_row->used[TEXT_AREA]);
! 
        /* Clear to end of window.  */
        rif->clear_end_of_line (-1);
        changed_p = 1;
***************
*** 4294,4300 ****
         extension actually takes place.  */
        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))
        --desired_stop_pos;
!       
        stop = min (current_row->used[TEXT_AREA], desired_stop_pos);
        i = 0;
        x = desired_row->x;
--- 4294,4300 ----
         extension actually takes place.  */
        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))
        --desired_stop_pos;
! 
        stop = min (current_row->used[TEXT_AREA], desired_stop_pos);
        i = 0;
        x = desired_row->x;
***************
*** 4304,4310 ****
        while (i < stop)
        {
          int can_skip_p = 1;
!         
          /* Skip over glyphs that both rows have in common.  These
             don't have to be written.  We can't skip if the last
             current glyph overlaps the glyph to its right.  For
--- 4304,4310 ----
        while (i < stop)
        {
          int can_skip_p = 1;
! 
          /* Skip over glyphs that both rows have in common.  These
             don't have to be written.  We can't skip if the last
             current glyph overlaps the glyph to its right.  For
***************
*** 4317,4328 ****
            {
              struct glyph *glyph = &current_row->glyphs[TEXT_AREA][i - 1];
              int left, right;
!             
              rif->get_glyph_overhangs (glyph, XFRAME (w->frame),
                                        &left, &right);
              can_skip_p = right == 0;
            }
!         
          if (can_skip_p)
            {
              while (i < stop
--- 4317,4328 ----
            {
              struct glyph *glyph = &current_row->glyphs[TEXT_AREA][i - 1];
              int left, right;
! 
              rif->get_glyph_overhangs (glyph, XFRAME (w->frame),
                                        &left, &right);
              can_skip_p = right == 0;
            }
! 
          if (can_skip_p)
            {
              while (i < stop
***************
*** 4347,4353 ****
                      != desired_row->used[TEXT_AREA]))
                {
                  int left, right;
!             
                  rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame),
                                            &left, &right);
                  while (left > 0 && i > 0)
--- 4347,4353 ----
                      != desired_row->used[TEXT_AREA]))
                {
                  int left, right;
! 
                  rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame),
                                            &left, &right);
                  while (left > 0 && i > 0)
***************
*** 4358,4364 ****
                    }
                }
            }
!         
          /* Try to avoid writing the entire rest of the desired row
             by looking for a resync point.  This mainly prevents
             mode line flickering in the case the mode line is in
--- 4358,4364 ----
                    }
                }
            }
! 
          /* Try to avoid writing the entire rest of the desired row
             by looking for a resync point.  This mainly prevents
             mode line flickering in the case the mode line is in
***************
*** 4395,4401 ****
              changed_p = 1;
            }
        }
!       
        /* Write the rest.  */
        if (i < desired_row->used[TEXT_AREA])
        {
--- 4395,4401 ----
              changed_p = 1;
            }
        }
! 
        /* Write the rest.  */
        if (i < desired_row->used[TEXT_AREA])
        {
***************
*** 4403,4409 ****
          rif->write_glyphs (desired_glyph, desired_row->used[TEXT_AREA] - i);
          changed_p = 1;
        }
!       
        /* Maybe clear to end of line.  */
        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))
        {
--- 4403,4409 ----
          rif->write_glyphs (desired_glyph, desired_row->used[TEXT_AREA] - i);
          changed_p = 1;
        }
! 
        /* Maybe clear to end of line.  */
        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))
        {
***************
*** 4427,4433 ****
          /* Otherwise clear to the end of the old row.  Everything
             after that position should be clear already.  */
          int x;
!         
          if (i >= desired_row->used[TEXT_AREA])
            rif->cursor_to (vpos, i, desired_row->y,
                            desired_row->x + desired_row->pixel_width);
--- 4427,4433 ----
          /* Otherwise clear to the end of the old row.  Everything
             after that position should be clear already.  */
          int x;
! 
          if (i >= desired_row->used[TEXT_AREA])
            rif->cursor_to (vpos, i, desired_row->y,
                            desired_row->x + desired_row->pixel_width);
***************
*** 4470,4477 ****
       know what line height values are in effect.  */
    updated_row = desired_row;
  
!   /* A row can be completely invisible in case a desired matrix was 
!      built with a vscroll and then make_cursor_line_fully_visible shifts 
       the matrix.  Make sure to make such rows current anyway, since
       we need the correct y-position, for example, in the current matrix.  */
    if (desired_row->mode_line_p
--- 4470,4477 ----
       know what line height values are in effect.  */
    updated_row = desired_row;
  
!   /* A row can be completely invisible in case a desired matrix was
!      built with a vscroll and then make_cursor_line_fully_visible shifts
       the matrix.  Make sure to make such rows current anyway, since
       we need the correct y-position, for example, in the current matrix.  */
    if (desired_row->mode_line_p
***************
*** 4486,4492 ****
          changed_p = 1;
          update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
        }
!       
        /* Update the display of the text area.  */
        if (update_text_area (w, vpos))
        {
--- 4486,4492 ----
          changed_p = 1;
          update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
        }
! 
        /* Update the display of the text area.  */
        if (update_text_area (w, vpos))
        {
***************
*** 4494,4500 ****
          if (current_row->mouse_face_p)
            *mouse_face_overwritten_p = 1;
        }
!       
        /* Update display of the right margin area, if there is one.  */
        if (!desired_row->full_width_p
          && !NILP (w->right_margin_width))
--- 4494,4500 ----
          if (current_row->mouse_face_p)
            *mouse_face_overwritten_p = 1;
        }
! 
        /* Update display of the right margin area, if there is one.  */
        if (!desired_row->full_width_p
          && !NILP (w->right_margin_width))
***************
*** 4502,4508 ****
          changed_p = 1;
          update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
        }
!       
        /* Draw truncation marks etc.  */
        if (!current_row->enabled_p
          || desired_row->y != current_row->y
--- 4502,4508 ----
          changed_p = 1;
          update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
        }
! 
        /* Draw truncation marks etc.  */
        if (!current_row->enabled_p
          || desired_row->y != current_row->y
***************
*** 4518,4524 ****
              != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
        rif->after_update_window_line_hook (desired_row);
      }
!   
    /* Update current_row from desired_row.  */
    make_current (w->desired_matrix, w->current_matrix, vpos);
    updated_row = NULL;
--- 4518,4524 ----
              != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
        rif->after_update_window_line_hook (desired_row);
      }
! 
    /* Update current_row from desired_row.  */
    make_current (w->desired_matrix, w->current_matrix, vpos);
    updated_row = NULL;
***************
*** 4538,4544 ****
  
    /* Not intended for frame matrix updates.  */
    xassert (FRAME_WINDOW_P (f));
!   
    if (cursor_in_echo_area
        && !NILP (echo_area_buffer[0])
        /* If we are showing a message instead of the mini-buffer,
--- 4538,4544 ----
  
    /* Not intended for frame matrix updates.  */
    xassert (FRAME_WINDOW_P (f));
! 
    if (cursor_in_echo_area
        && !NILP (echo_area_buffer[0])
        /* If we are showing a message instead of the mini-buffer,
***************
*** 4573,4579 ****
                last_row = row;
              ++row;
            }
!         
          if (last_row)
            {
              struct glyph *start = last_row->glyphs[TEXT_AREA];
--- 4573,4579 ----
                last_row = row;
              ++row;
            }
! 
          if (last_row)
            {
              struct glyph *start = last_row->glyphs[TEXT_AREA];
***************
*** 4581,4587 ****
  
              while (last > start && last->charpos < 0)
                --last;
!             
              for (glyph = start; glyph < last; ++glyph)
                {
                  cx += glyph->pixel_width;
--- 4581,4587 ----
  
              while (last > start && last->charpos < 0)
                --last;
! 
              for (glyph = start; glyph < last; ++glyph)
                {
                  cx += glyph->pixel_width;
***************
*** 4629,4635 ****
  
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
! }    
  
  
  
--- 4629,4635 ----
  
        w = NILP (w->next) ? 0 : XWINDOW (w->next);
      }
! }
  
  
  
***************
*** 4643,4658 ****
  {
    /* Number of occurrences of this row in desired and current matrix.  */
    int old_uses, new_uses;
!     
    /* Vpos of row in new matrix.  */
    int new_line_number;
  
    /* Bucket index of this row_entry in the hash table row_table.  */
    int bucket;
!     
    /* The row described by this entry.  */
    struct glyph_row *row;
!     
    /* Hash collision chain.  */
    struct row_entry *next;
  };
--- 4643,4658 ----
  {
    /* Number of occurrences of this row in desired and current matrix.  */
    int old_uses, new_uses;
! 
    /* Vpos of row in new matrix.  */
    int new_line_number;
  
    /* Bucket index of this row_entry in the hash table row_table.  */
    int bucket;
! 
    /* The row described by this entry.  */
    struct glyph_row *row;
! 
    /* Hash collision chain.  */
    struct row_entry *next;
  };
***************
*** 4700,4710 ****
  {
    struct row_entry *entry;
    int i = row->hash % row_table_size;
!   
    entry = row_table[i];
    while (entry && !row_equal_p (w, entry->row, row, 1))
      entry = entry->next;
!   
    if (entry == NULL)
      {
        entry = row_entry_pool + row_entry_idx++;
--- 4700,4710 ----
  {
    struct row_entry *entry;
    int i = row->hash % row_table_size;
! 
    entry = row_table[i];
    while (entry && !row_equal_p (w, entry->row, row, 1))
      entry = entry->next;
! 
    if (entry == NULL)
      {
        entry = row_entry_pool + row_entry_idx++;
***************
*** 4781,4787 ****
    /* Give up if some rows in the desired matrix are not enabled.  */
    if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
      return -1;
!   
    first_old = first_new = i;
  
    /* Set last_new to the index + 1 of the last enabled row in the
--- 4781,4787 ----
    /* Give up if some rows in the desired matrix are not enabled.  */
    if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
      return -1;
! 
    first_old = first_new = i;
  
    /* Set last_new to the index + 1 of the last enabled row in the
***************
*** 4833,4846 ****
      return 0;
  
    /* Reallocate vectors, tables etc. if necessary.  */
!   
    if (current_matrix->nrows > old_lines_size)
      {
        old_lines_size = current_matrix->nrows;
        nbytes = old_lines_size * sizeof *old_lines;
        old_lines = (struct row_entry **) xrealloc (old_lines, nbytes);
      }
!   
    if (desired_matrix->nrows > new_lines_size)
      {
        new_lines_size = desired_matrix->nrows;
--- 4833,4846 ----
      return 0;
  
    /* Reallocate vectors, tables etc. if necessary.  */
! 
    if (current_matrix->nrows > old_lines_size)
      {
        old_lines_size = current_matrix->nrows;
        nbytes = old_lines_size * sizeof *old_lines;
        old_lines = (struct row_entry **) xrealloc (old_lines, nbytes);
      }
! 
    if (desired_matrix->nrows > new_lines_size)
      {
        new_lines_size = desired_matrix->nrows;
***************
*** 4878,4884 ****
  
    /* Add rows from the current and desired matrix to the hash table
       row_hash_table to be able to find equal ones quickly.  */
!   
    for (i = first_old; i < last_old; ++i)
      {
        if (MATRIX_ROW (current_matrix, i)->enabled_p)
--- 4878,4884 ----
  
    /* Add rows from the current and desired matrix to the hash table
       row_hash_table to be able to find equal ones quickly.  */
! 
    for (i = first_old; i < last_old; ++i)
      {
        if (MATRIX_ROW (current_matrix, i)->enabled_p)
***************
*** 4927,4934 ****
               && old_lines[j] == new_lines[k])
          {
            int h = MATRIX_ROW (current_matrix, j)->height;
!           --run->current_vpos; 
!           --run->desired_vpos; 
            ++run->nrows;
            run->height += h;
            run->desired_y -= h;
--- 4927,4934 ----
               && old_lines[j] == new_lines[k])
          {
            int h = MATRIX_ROW (current_matrix, j)->height;
!           --run->current_vpos;
!           --run->desired_vpos;
            ++run->nrows;
            run->height += h;
            run->desired_y -= h;
***************
*** 4944,4950 ****
               && old_lines[j] == new_lines[k])
          {
            int h = MATRIX_ROW (current_matrix, j)->height;
!           ++run->nrows; 
            run->height += h;
            ++j, ++k;
          }
--- 4944,4950 ----
               && old_lines[j] == new_lines[k])
          {
            int h = MATRIX_ROW (current_matrix, j)->height;
!           ++run->nrows;
            run->height += h;
            ++j, ++k;
          }
***************
*** 4994,5000 ****
            for (j = i + 1; j < nruns; ++j)
              {
                struct run *p = runs[j];
!               
                if ((p->current_y >= r->desired_y
                     && p->current_y < r->desired_y + r->height)
                    || (p->current_y + p->height >= r->desired_y
--- 4994,5000 ----
            for (j = i + 1; j < nruns; ++j)
              {
                struct run *p = runs[j];
! 
                if ((p->current_y >= r->desired_y
                     && p->current_y < r->desired_y + r->height)
                    || (p->current_y + p->height >= r->desired_y
***************
*** 5126,5132 ****
          update_frame_line (f, i);
        }
      }
!   
    pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0;
  
    /* Now just clean up termcap drivers and set cursor, etc.  */
--- 5126,5132 ----
          update_frame_line (f, i);
        }
      }
! 
    pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0;
  
    /* Now just clean up termcap drivers and set cursor, etc.  */
***************
*** 5161,5171 ****
                 is several lines high, find the last line that has
                 any text on it.  */
              row = FRAME_HEIGHT (f);
!             do 
                {
                  --row;
                  col = 0;
!                 
                  if (MATRIX_ROW_ENABLED_P (current_matrix, row))
                    {
                      /* Frame rows are filled up with spaces that
--- 5161,5171 ----
                 is several lines high, find the last line that has
                 any text on it.  */
              row = FRAME_HEIGHT (f);
!             do
                {
                  --row;
                  col = 0;
! 
                  if (MATRIX_ROW_ENABLED_P (current_matrix, row))
                    {
                      /* Frame rows are filled up with spaces that
***************
*** 5178,5184 ****
                      while (last > start
                             && (last - 1)->charpos < 0)
                        --last;
!                     
                      col = last - start;
                    }
                }
--- 5178,5184 ----
                      while (last > start
                             && (last - 1)->charpos < 0)
                        --last;
! 
                      col = last - start;
                    }
                }
***************
*** 5219,5225 ****
  
              if (INTEGERP (w->left_margin_width))
                x += XFASTINT (w->left_margin_width);
!             
              /* x = max (min (x, FRAME_WINDOW_WIDTH (f) - 1), 0); */
              cursor_to (y, x);
            }
--- 5219,5225 ----
  
              if (INTEGERP (w->left_margin_width))
                x += XFASTINT (w->left_margin_width);
! 
              /* x = max (min (x, FRAME_WINDOW_WIDTH (f) - 1), 0); */
              cursor_to (y, x);
            }
***************
*** 5334,5340 ****
       int len;
  {
    int i;
!   
    for (i = 0; i < len; ++i)
      if (!CHAR_GLYPH_SPACE_P (r[i]))
        break;
--- 5334,5340 ----
       int len;
  {
    int i;
! 
    for (i = 0; i < len; ++i)
      if (!CHAR_GLYPH_SPACE_P (r[i]))
        break;
***************
*** 5353,5364 ****
  {
    struct glyph *p1 = str1;
    struct glyph *p2 = str2;
!   
    while (p1 < end1
         && p2 < end2
         && GLYPH_CHAR_AND_FACE_EQUAL_P (p1, p2))
      ++p1, ++p2;
!   
    return p1 - str1;
  }
  
--- 5353,5364 ----
  {
    struct glyph *p1 = str1;
    struct glyph *p2 = str2;
! 
    while (p1 < end1
         && p2 < end2
         && GLYPH_CHAR_AND_FACE_EQUAL_P (p1, p2))
      ++p1, ++p2;
! 
    return p1 - str1;
  }
  
***************
*** 5403,5409 ****
      {
        obody = MATRIX_ROW_GLYPH_START (current_matrix, vpos);
        olen = current_row->used[TEXT_AREA];
!       
        /* Ignore trailing spaces, if we can.  */
        if (!write_spaces_p)
        while (olen > 0 && CHAR_GLYPH_SPACE_P (obody[olen-1]))
--- 5403,5409 ----
      {
        obody = MATRIX_ROW_GLYPH_START (current_matrix, vpos);
        olen = current_row->used[TEXT_AREA];
! 
        /* Ignore trailing spaces, if we can.  */
        if (!write_spaces_p)
        while (olen > 0 && CHAR_GLYPH_SPACE_P (obody[olen-1]))
***************
*** 5438,5444 ****
            cursor_to (vpos, 0);
          write_glyphs (nbody, nlen);
        }
!       
        /* Don't call clear_end_of_line if we already wrote the whole
         line.  The cursor will not be at the right margin in that
         case but in the line below.  */
--- 5438,5444 ----
            cursor_to (vpos, 0);
          write_glyphs (nbody, nlen);
        }
! 
        /* Don't call clear_end_of_line if we already wrote the whole
         line.  The cursor will not be at the right margin in that
         case but in the line below.  */
***************
*** 5451,5457 ****
        /* Make sure we are in the right row, otherwise cursor movement
           with cmgoto might use `ch' in the wrong row.  */
        cursor_to (vpos, 0);
!       
        make_current (desired_matrix, current_matrix, vpos);
        return;
      }
--- 5451,5457 ----
        /* Make sure we are in the right row, otherwise cursor movement
           with cmgoto might use `ch' in the wrong row.  */
        cursor_to (vpos, 0);
! 
        make_current (desired_matrix, current_matrix, vpos);
        return;
      }
***************
*** 5480,5487 ****
                         || !GLYPH_EQUAL_P (nbody + j, obody + j)
                         || CHAR_GLYPH_PADDING_P (nbody[j])))
                ++j;
!                    
!             /* Output this run of non-matching chars.  */ 
              cursor_to (vpos, i);
              write_glyphs (nbody + i, j - i);
              i = j - 1;
--- 5480,5487 ----
                         || !GLYPH_EQUAL_P (nbody + j, obody + j)
                         || CHAR_GLYPH_PADDING_P (nbody[j])))
                ++j;
! 
!             /* Output this run of non-matching chars.  */
              cursor_to (vpos, i);
              write_glyphs (nbody + i, j - i);
              i = j - 1;
***************
*** 5641,5657 ****
          int del;
  
          cursor_to (vpos, nsp + begmatch);
!         
          /* Calculate columns we can actually overwrite.  */
          while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out]))
            out--;
          write_glyphs (nbody + nsp + begmatch, out);
!         
          /* If we left columns to be overwritten, we must delete them.  */
          del = olen - tem - out;
          if (del > 0)
            delete_glyphs (del);
!         
          /* At last, we insert columns not yet written out.  */
          insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del);
          olen = nlen;
--- 5641,5657 ----
          int del;
  
          cursor_to (vpos, nsp + begmatch);
! 
          /* Calculate columns we can actually overwrite.  */
          while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out]))
            out--;
          write_glyphs (nbody + nsp + begmatch, out);
! 
          /* If we left columns to be overwritten, we must delete them.  */
          del = olen - tem - out;
          if (del > 0)
            delete_glyphs (del);
! 
          /* At last, we insert columns not yet written out.  */
          insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del);
          olen = nlen;
***************
*** 5705,5715 ****
    CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp)));
    BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
    start_display (&it, w, startp);
!   
    left_area_width = WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH (w);
    move_it_to (&it, -1, *x + it.first_visible_x - left_area_width, *y, -1,
              MOVE_TO_X | MOVE_TO_Y);
!   
    *x = it.current_x - it.first_visible_x + left_area_width;
    *y = it.current_y;
    current_buffer = old_current_buffer;
--- 5705,5715 ----
    CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp)));
    BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
    start_display (&it, w, startp);
! 
    left_area_width = WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH (w);
    move_it_to (&it, -1, *x + it.first_visible_x - left_area_width, *y, -1,
              MOVE_TO_X | MOVE_TO_Y);
! 
    *x = it.current_x - it.first_visible_x + left_area_width;
    *y = it.current_y;
    current_buffer = old_current_buffer;
***************
*** 5873,5879 ****
    /* If window_change_signal should have run before, run it now.  */
    if (redisplaying_p && !safe)
      return;
!   
    while (delayed_size_change)
      {
        Lisp_Object tail, frame;
--- 5873,5879 ----
    /* If window_change_signal should have run before, run it now.  */
    if (redisplaying_p && !safe)
      return;
! 
    while (delayed_size_change)
      {
        Lisp_Object tail, frame;
***************
*** 5895,5901 ****
  
  
  /* Change the frame height and/or width.  Values may be given as zero to
!    indicate no change is to take place. 
  
     If DELAY is non-zero, then assume we're being called from a signal
     handler, and queue the change for later - perhaps the next
--- 5895,5901 ----
  
  
  /* Change the frame height and/or width.  Values may be given as zero to
!    indicate no change is to take place.
  
     If DELAY is non-zero, then assume we're being called from a signal
     handler, and queue the change for later - perhaps the next
***************
*** 6017,6023 ****
    {
      struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
      int text_area_x, text_area_y, text_area_width, text_area_height;
!     
      window_box (w, TEXT_AREA, &text_area_x, &text_area_y, &text_area_width,
                &text_area_height);
      if (w->cursor.x >= text_area_x + text_area_width)
--- 6017,6023 ----
    {
      struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
      int text_area_x, text_area_y, text_area_width, text_area_height;
! 
      window_box (w, TEXT_AREA, &text_area_x, &text_area_y, &text_area_width,
                &text_area_height);
      if (w->cursor.x >= text_area_x + text_area_width)
***************
*** 6190,6203 ****
  #ifdef VMS
    sys_sleep (sec);
  #else /* not VMS */
! /* The reason this is done this way 
      (rather than defined (H_S) && defined (H_T))
     is because the VMS preprocessor doesn't grok `defined'.  */
  #ifdef HAVE_SELECT
    EMACS_GET_TIME (end_time);
    EMACS_SET_SECS_USECS (timeout, sec, usec);
    EMACS_ADD_TIME (end_time, end_time, timeout);
!  
    while (1)
      {
        EMACS_GET_TIME (timeout);
--- 6190,6203 ----
  #ifdef VMS
    sys_sleep (sec);
  #else /* not VMS */
! /* The reason this is done this way
      (rather than defined (H_S) && defined (H_T))
     is because the VMS preprocessor doesn't grok `defined'.  */
  #ifdef HAVE_SELECT
    EMACS_GET_TIME (end_time);
    EMACS_SET_SECS_USECS (timeout, sec, usec);
    EMACS_ADD_TIME (end_time, end_time, timeout);
! 
    while (1)
      {
        EMACS_GET_TIME (timeout);
***************
*** 6210,6216 ****
    sleep (sec);
  #endif /* HAVE_SELECT */
  #endif /* not VMS */
!   
    immediate_quit = 0;
  #endif /* no subprocesses */
  
--- 6210,6216 ----
    sleep (sec);
  #endif /* HAVE_SELECT */
  #endif /* not VMS */
! 
    immediate_quit = 0;
  #endif /* no subprocesses */
  
***************
*** 6439,6445 ****
        display_arg = (display != 0 && *display != 0);
      }
  
!   if (!inhibit_window_system && display_arg 
  #ifndef CANNOT_DUMP
       && initialized
  #endif
--- 6439,6445 ----
        display_arg = (display != 0 && *display != 0);
      }
  
!   if (!inhibit_window_system && display_arg
  #ifndef CANNOT_DUMP
       && initialized
  #endif
***************
*** 6463,6469 ****
  #endif /* HAVE_X_WINDOWS */
  
  #ifdef HAVE_NTGUI
!   if (!inhibit_window_system) 
      {
        Vwindow_system = intern ("w32");
        Vwindow_system_version = make_number (1);
--- 6463,6469 ----
  #endif /* HAVE_X_WINDOWS */
  
  #ifdef HAVE_NTGUI
!   if (!inhibit_window_system)
      {
        Vwindow_system = intern ("w32");
        Vwindow_system_version = make_number (1);
***************
*** 6473,6479 ****
  #endif /* HAVE_NTGUI */
  
  #ifdef MAC_OS
!   if (!inhibit_window_system) 
      {
        Vwindow_system = intern ("mac");
        Vwindow_system_version = make_number (1);
--- 6473,6479 ----
  #endif /* HAVE_NTGUI */
  
  #ifdef MAC_OS
!   if (!inhibit_window_system)
      {
        Vwindow_system = intern ("mac");
        Vwindow_system_version = make_number (1);
***************
*** 6518,6528 ****
        *p = tolower (*p);
  
      terminal_type = new;
!   }   
  #endif /* VMS */
  
    term_init (terminal_type);
!   
    {
      struct frame *sf = SELECTED_FRAME ();
      int width = FRAME_WINDOW_WIDTH (sf);
--- 6518,6528 ----
        *p = tolower (*p);
  
      terminal_type = new;
!   }
  #endif /* VMS */
  
    term_init (terminal_type);
! 
    {
      struct frame *sf = SELECTED_FRAME ();
      int width = FRAME_WINDOW_WIDTH (sf);
***************
*** 6591,6597 ****
        window = selected_window;
        else
        CHECK_WINDOW (window);
!       
        XWINDOW (window)->cursor_off_p = NILP (show);
      }
  
--- 6591,6597 ----
        window = selected_window;
        else
        CHECK_WINDOW (window);
! 
        XWINDOW (window)->cursor_off_p = NILP (show);
      }
  
***************
*** 6607,6620 ****
       Lisp_Object window;
  {
    struct window *w;
!   
    if (NILP (window))
      window = selected_window;
    else
      CHECK_WINDOW (window);
!   
    w = XWINDOW (window);
!   return w->cursor_off_p ? Qnil : Qt;    
  }
  
  
--- 6607,6620 ----
       Lisp_Object window;
  {
    struct window *w;
! 
    if (NILP (window))
      window = selected_window;
    else
      CHECK_WINDOW (window);
! 
    w = XWINDOW (window);
!   return w->cursor_off_p ? Qnil : Qt;
  }
  
  
***************
*** 6652,6685 ****
              doc: /* *The output baud rate of the terminal.
  On most systems, changing this value will affect the amount of padding
  and the other strategic decisions made during redisplay.  */);
!   
    DEFVAR_BOOL ("inverse-video", &inverse_video,
               doc: /* *Non-nil means invert the entire frame display.
  This means everything is in inverse video which otherwise would not be.  */);
!   
    DEFVAR_BOOL ("visible-bell", &visible_bell,
               doc: /* *Non-nil means try to flash the frame to represent a 
bell.
  
  See also `ring-bell-function'.  */);
!   
    DEFVAR_BOOL ("no-redraw-on-reenter", &no_redraw_on_reenter,
               doc: /* *Non-nil means no need to redraw entire frame after 
suspending.
  A non-nil value is useful if the terminal can automatically preserve
  Emacs's frame display when you reenter Emacs.
  It is up to you to set this variable if your terminal can do that.  */);
!   
    DEFVAR_LISP ("window-system", &Vwindow_system,
               doc: /* Name of window system that Emacs is displaying through.
  The value is a symbol--for instance, `x' for X windows.
  The value is nil if Emacs is using a text-only terminal.  */);
!   
    DEFVAR_LISP ("window-system-version", &Vwindow_system_version,
               doc: /* The version number of the window system in use.
  For X windows, this is 10 or 11.  */);
!   
    DEFVAR_BOOL ("cursor-in-echo-area", &cursor_in_echo_area,
               doc: /* Non-nil means put cursor in minibuffer, at end of any 
message there.  */);
!   
    DEFVAR_LISP ("glyph-table", &Vglyph_table,
               doc: /* Table defining how to output a glyph code to the frame.
  If not nil, this is a vector indexed by glyph code to define the glyph.
--- 6652,6685 ----
              doc: /* *The output baud rate of the terminal.
  On most systems, changing this value will affect the amount of padding
  and the other strategic decisions made during redisplay.  */);
! 
    DEFVAR_BOOL ("inverse-video", &inverse_video,
               doc: /* *Non-nil means invert the entire frame display.
  This means everything is in inverse video which otherwise would not be.  */);
! 
    DEFVAR_BOOL ("visible-bell", &visible_bell,
               doc: /* *Non-nil means try to flash the frame to represent a 
bell.
  
  See also `ring-bell-function'.  */);
! 
    DEFVAR_BOOL ("no-redraw-on-reenter", &no_redraw_on_reenter,
               doc: /* *Non-nil means no need to redraw entire frame after 
suspending.
  A non-nil value is useful if the terminal can automatically preserve
  Emacs's frame display when you reenter Emacs.
  It is up to you to set this variable if your terminal can do that.  */);
! 
    DEFVAR_LISP ("window-system", &Vwindow_system,
               doc: /* Name of window system that Emacs is displaying through.
  The value is a symbol--for instance, `x' for X windows.
  The value is nil if Emacs is using a text-only terminal.  */);
! 
    DEFVAR_LISP ("window-system-version", &Vwindow_system_version,
               doc: /* The version number of the window system in use.
  For X windows, this is 10 or 11.  */);
! 
    DEFVAR_BOOL ("cursor-in-echo-area", &cursor_in_echo_area,
               doc: /* Non-nil means put cursor in minibuffer, at end of any 
message there.  */);
! 
    DEFVAR_LISP ("glyph-table", &Vglyph_table,
               doc: /* Table defining how to output a glyph code to the frame.
  If not nil, this is a vector indexed by glyph code to define the glyph.




reply via email to

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