]> git.eshelyaron.com Git - emacs.git/commitdiff
(try_window_reusing_current_matrix): Use
authorGerd Moellmann <gerd@gnu.org>
Wed, 24 Oct 2001 09:11:54 +0000 (09:11 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 24 Oct 2001 09:11:54 +0000 (09:11 +0000)
row_containing_pos.
(row_containing_pos): Take additional argument DY.  Treat
rows ending in middle of char differently.
(display_line): Handle tabs on window systems differently.

src/xdisp.c

index 14413ca8f45954e1f95c22ac14293c27d6eec647..45b179a6ac63233572c1258acce265ef924ac19d 100644 (file)
@@ -10705,26 +10705,11 @@ try_window_reusing_current_matrix (w)
              int dy = it.current_y - first_row_y;
              
              row = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
-             while (MATRIX_ROW_DISPLAYS_TEXT_P (row))
-               {
-                 if (PT >= MATRIX_ROW_START_CHARPOS (row)
-                     && PT < MATRIX_ROW_END_CHARPOS (row))
-                   {
-                     set_cursor_from_row (w, row, w->current_matrix, 0, 0,
-                                          dy, nrows_scrolled);
-                     break;
-                   }
-                 
-                 if (MATRIX_ROW_BOTTOM_Y (row) + dy >= it.last_visible_y)
-                   break;
-                 
-                 ++row;
-               }
-             
-             /* Give up if point was not found.  This shouldn't
-                happen often; not more often than with try_window
-                itself.  */
-             if (w->cursor.vpos < 0)
+             row = row_containing_pos (w, PT, row, NULL, dy);
+             if (row)
+               set_cursor_from_row (w, row, w->current_matrix, 0, 0,
+                                    dy, nrows_scrolled);
+             else
                {
                  clear_glyph_matrix (w->desired_matrix);
                  return 0;
@@ -11200,10 +11185,11 @@ sync_frame_with_window_matrix_rows (w)
    containing CHARPOS or null.  */
 
 struct glyph_row *
-row_containing_pos (w, charpos, start, end)
+row_containing_pos (w, charpos, start, end, dy)
      struct window *w;
      int charpos;
      struct glyph_row *start, *end;
+     int dy;
 {
   struct glyph_row *row = start;
   int last_y;
@@ -11215,18 +11201,18 @@ row_containing_pos (w, charpos, start, end)
   if ((end && row >= end) || !row->enabled_p)
     return NULL;
   
-  last_y = window_text_bottom_y (w);
+  last_y = window_text_bottom_y (w) - dy;
       
   while ((end == NULL || row < end)
+        && MATRIX_ROW_BOTTOM_Y (row) < last_y
         && (MATRIX_ROW_END_CHARPOS (row) < charpos
-            /* The end position of a row equals the start
-               position of the next row.  If CHARPOS is there, we
-               would rather display it in the next line, except
-               when this line ends in ZV.  */
             || (MATRIX_ROW_END_CHARPOS (row) == charpos
-                && (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)
-                    || !row->ends_at_zv_p)))
-        && MATRIX_ROW_BOTTOM_Y (row) < last_y)
+                /* The end position of a row equals the start
+                   position of the next row.  If CHARPOS is there, we
+                   would rather display it in the next line, except
+                   when this line ends in ZV.  */
+                && !row->ends_at_zv_p
+                && !MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))))
     ++row;
       
   /* Give up if CHARPOS not found.  */
@@ -11435,7 +11421,7 @@ try_window_id (w)
            }
       
          /* Set the cursor.  */
-         row = row_containing_pos (w, PT, r0, NULL);
+         row = row_containing_pos (w, PT, r0, NULL, 0);
          set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
          return 1;
        }
@@ -11473,7 +11459,7 @@ try_window_id (w)
            = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row);
 
          /* Set the cursor.  */
-         row = row_containing_pos (w, PT, r0, NULL);
+         row = row_containing_pos (w, PT, r0, NULL, 0);
          set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0);
          return 2;
        }
@@ -11672,7 +11658,7 @@ try_window_id (w)
        {
          row = row_containing_pos (w, PT,
                                    MATRIX_FIRST_TEXT_ROW (w->current_matrix),
-                                   last_unchanged_at_beg_row + 1);
+                                   last_unchanged_at_beg_row + 1, 0);
          if (row)
            set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
        }
@@ -11681,7 +11667,7 @@ try_window_id (w)
       else if (first_unchanged_at_end_row)
        {
          row = row_containing_pos (w, PT - delta,
-                                   first_unchanged_at_end_row, NULL);
+                                   first_unchanged_at_end_row, NULL, 0);
          if (row)
            set_cursor_from_row (w, row, w->current_matrix, delta,
                                 delta_bytes, dy, dvpos);
@@ -12945,11 +12931,24 @@ display_line (it)
                      it->max_phys_ascent = phys_ascent;
                      it->max_phys_descent = phys_descent;
                    }
+                 else if (it->c == '\t' && FRAME_WINDOW_P (it->f))
+                   {
+                     /* A TAB that extends past the right edge of the
+                        window.  This produces a single glyph on
+                        window system frames.  We leave the glyph in
+                        this row and let it fill the row, but don't
+                        consume the TAB.  */
+                     it->continuation_lines_width += it->last_visible_x;
+                     row->ends_in_middle_of_char_p = 1;
+                     row->continued_p = 1;
+                     glyph->pixel_width = it->last_visible_x - x;
+                     it->starts_in_middle_of_char_p = 1;
+                   }
                  else
                    {
-                     /* Display element draws past the right edge of
-                        the window.  Restore positions to values
-                        before the element.  */
+                     /* Something other than a TAB that draws past
+                        the right edge of the window.  Restore
+                        positions to values before the element.  */
                      row->used[TEXT_AREA] = n_glyphs_before + i;
                  
                      /* Display continuation glyphs.  */
@@ -12957,14 +12956,7 @@ display_line (it)
                        produce_special_glyphs (it, IT_CONTINUATION);
                      row->continued_p = 1;
 
-                     /* A TAB takes us to the right edge of the window.  */
-                     if (it->c == '\t')
-                       {
-                         it->continuation_lines_width += it->last_visible_x;
-                         row->ends_in_middle_of_char_p = 1;
-                       }
-                     else
-                       it->continuation_lines_width += x;
+                     it->continuation_lines_width += x;
                      
                      if (nglyphs > 1 && i > 0)
                        {