]> code.delx.au - gnu-emacs/blobdiff - src/dispnew.c
(update_frame_line): If writing whole line,
[gnu-emacs] / src / dispnew.c
index cac7a051767c0d2cbce7afef0b971d1cc95190b0..9906022b00e53ecc6ce1c5084e5f79b1ae8296e8 100644 (file)
@@ -2467,6 +2467,10 @@ build_frame_matrix_from_leaf_window (frame_matrix, w)
 
          /* 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);
+#endif
        }
 
       /* Set number of used glyphs in the frame matrix.  Since we fill
@@ -2628,8 +2632,11 @@ mirror_make_current (w, frame_row)
                = MATRIX_ROW (w->current_matrix, row);
              struct glyph_row *desired_row
                = MATRIX_ROW (w->desired_matrix, row);
-             
-             assign_row (current_row, desired_row);
+
+             if (desired_row->enabled_p)
+               assign_row (current_row, desired_row);
+             else
+               swap_glyph_pointers (desired_row, current_row);
              current_row->enabled_p = 1;
            }
        }
@@ -3064,7 +3071,7 @@ direct_output_for_insert (g)
   /* 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.  */
-  if (it.show_trailing_whitespace_p
+  if (!NILP (Vshow_trailing_whitespace)
       && glyph_row->used[TEXT_AREA])
     {
       struct glyph *last;
@@ -3178,7 +3185,7 @@ direct_output_for_insert (g)
   glyph_row->contains_overlapping_glyphs_p
     |= it.glyph_row->contains_overlapping_glyphs_p;
 
-  if (it.show_trailing_whitespace_p)
+  if (!NILP (Vshow_trailing_whitespace))
     highlight_trailing_whitespace (it.f, glyph_row);
 
   /* Write glyphs.  If at end of row, we can simply call write_glyphs.
@@ -3276,6 +3283,10 @@ direct_output_forward_char (n)
   if (!NILP (Vtransient_mark_mode) && !NILP (current_buffer->mark_active))
     return 0;
 
+  /* Can't use direct output if highlighting trailing whitespace.  */
+  if (!NILP (Vshow_trailing_whitespace))
+    return 0;
+
   row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
 
   if (PT <= MATRIX_ROW_START_BYTEPOS (row)
@@ -4028,28 +4039,37 @@ set_window_cursor_after_update (w)
             line that has any text on it.  Note: either all lines
             are enabled or none.  Otherwise we wouldn't be able to
             determine Y.  */
-         struct glyph_row *row = MATRIX_ROW (w->current_matrix, 0);
-         int vpos, last_row_vpos;
-         struct glyph_row *last_row = NULL;
+         struct glyph_row *row, *last_row;
+         struct glyph *glyph;
+         int yb = window_text_bottom_y (w);
 
-         vpos = 0;
-         while (vpos < w->current_matrix->nrows)
+         last_row = NULL;
+         for (row = MATRIX_ROW (w->current_matrix, 0);; ++row)
            {
-             if (row->enabled_p && row->used[TEXT_AREA])
-               {
-                 last_row = row;
-                 last_row_vpos = vpos;
-               }
-             ++row;
-             ++vpos;
-           }
+             if (row->used[TEXT_AREA]
+                 && row->glyphs[TEXT_AREA][0].charpos >= 0)
+               last_row = row;
 
+             if (MATRIX_ROW_BOTTOM_Y (row) >= yb)
+               break;
+           }
+         
          if (last_row)
            {
-             cx = last_row->pixel_width;
-             hpos = last_row->used[TEXT_AREA];
+             struct glyph *start = row->glyphs[TEXT_AREA];
+             struct glyph *last = start + row->used[TEXT_AREA];
+
+             while (last > start && (last - 1)->charpos < 0)
+               --last;
+             
+             for (glyph = start; glyph < last; ++glyph)
+               {
+                 cx += glyph->pixel_width;
+                 ++hpos;
+               }
+
              cy = last_row->y;
-             vpos = last_row_vpos;
+             vpos = MATRIX_ROW_VPOS (last_row, w->current_matrix);
            }
        }
     }
@@ -4816,10 +4836,18 @@ update_frame_line (frame, vpos)
   /* If display line has unknown contents, write the whole line.  */
   if (must_write_whole_line_p)
     {
-      cursor_to (vpos, 0);
-      write_glyphs (nbody, nlen);
+      if (!must_write_spaces)
+       while (nlen > 0 && CHAR_GLYPH_SPACE_P (nbody[nlen - 1]))
+         --nlen;
+
+      if (nlen)
+       {
+         cursor_to (vpos, 0);
+         write_glyphs (nbody, nlen);
+       }
+      
       cursor_to (vpos, nlen);
-      clear_end_of_line (-1);
+      clear_end_of_line (olen);
       make_current (desired_matrix, current_matrix, vpos);
       return;
     }