(calc-set-mode-line): Add square matrix option.
[bpt/emacs.git] / src / fringe.c
index f375159..754ee68 100644 (file)
@@ -1,6 +1,7 @@
 /* Fringe handling (split from xdisp.c).
-   Copyright (C) 1985,86,87,88,93,94,95,97,98,99,2000,01,02,03,04
-   Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1997,
+                 1998, 1999, 2000, 2000, 2001, 2002, 2003, 2004,
+                 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -16,8 +17,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 #include <config.h>
 #include <stdio.h>
@@ -699,11 +700,11 @@ draw_fringe_bitmap (w, row, left_p)
 
   draw_fringe_bitmap_1 (w, row, left_p, overlay, NO_FRINGE_BITMAP);
 
-  if (left_p && row->overlay_arrow_p)
+  if (left_p && row->overlay_arrow_bitmap != NO_FRINGE_BITMAP)
     draw_fringe_bitmap_1 (w, row, 1, 1,
-                         (w->overlay_arrow_bitmap
-                          ? w->overlay_arrow_bitmap
-                          : OVERLAY_ARROW_BITMAP));
+                         (row->overlay_arrow_bitmap < 0
+                          ? OVERLAY_ARROW_BITMAP
+                          : row->overlay_arrow_bitmap));
 }
 
 
@@ -776,13 +777,14 @@ draw_window_fringes (w, no_fringe)
 
 
 /* Recalculate the bitmaps to show in the fringes of window W.
-   If FORCE_P is 0, only mark rows with modified bitmaps for update in
-   redraw_fringe_bitmaps_p; else mark all rows for update.  */
+   Only mark rows with modified bitmaps for update in redraw_fringe_bitmaps_p.
+
+   If KEEP_CURRENT_P is 0, update current_matrix too.  */
 
 int
-update_window_fringes (w, force_p)
+update_window_fringes (w, keep_current_p)
      struct window *w;
-     int force_p;
+     int keep_current_p;
 {
   struct glyph_row *row, *cur = 0;
   int yb = window_text_bottom_y (w);
@@ -848,7 +850,8 @@ update_window_fringes (w, force_p)
            {
              if (!done_top)
                {
-                 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)))
+                 if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer))
+                     && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row))
                    row->indicate_bob_p = !NILP (boundary_top);
                  else
                    row->indicate_top_line_p = !NILP (arrow_top);
@@ -857,7 +860,8 @@ update_window_fringes (w, force_p)
 
              if (!done_bot)
                {
-                 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)))
+                 if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer))
+                     && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row))
                    row->indicate_eob_p = !NILP (boundary_bot), done_bot = 1;
                  else if (y + row->height >= yb)
                    row->indicate_bottom_line_p = !NILP (arrow_bot), done_bot = 1;
@@ -942,8 +946,7 @@ update_window_fringes (w, force_p)
       else
        right = NO_FRINGE_BITMAP;
 
-      if (force_p
-         || row->y != cur->y
+      if (row->y != cur->y
          || row->visible_height != cur->visible_height
          || row->ends_at_zv_p != cur->ends_at_zv_p
          || left != cur->left_fringe_bitmap
@@ -952,17 +955,21 @@ update_window_fringes (w, force_p)
          || right_face_id != cur->right_fringe_face_id
          || cur->redraw_fringe_bitmaps_p)
        {
-         redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
-         cur->left_fringe_bitmap = left;
-         cur->right_fringe_bitmap = right;
-         cur->left_fringe_face_id = left_face_id;
-         cur->right_fringe_face_id = right_face_id;
+         redraw_p = row->redraw_fringe_bitmaps_p = 1;
+         if (!keep_current_p)
+           {
+             cur->redraw_fringe_bitmaps_p = 1;
+             cur->left_fringe_bitmap = left;
+             cur->right_fringe_bitmap = right;
+             cur->left_fringe_face_id = left_face_id;
+             cur->right_fringe_face_id = right_face_id;
+           }
        }
 
-      if (row->overlay_arrow_p != cur->overlay_arrow_p)
+      if (row->overlay_arrow_bitmap != cur->overlay_arrow_bitmap)
        {
          redraw_p = row->redraw_fringe_bitmaps_p = cur->redraw_fringe_bitmaps_p = 1;
-         cur->overlay_arrow_p = row->overlay_arrow_p;
+         cur->overlay_arrow_bitmap = row->overlay_arrow_bitmap;
        }
 
       row->left_fringe_bitmap = left;
@@ -974,7 +981,7 @@ update_window_fringes (w, force_p)
        row[-1].redraw_fringe_bitmaps_p = cur[-1].redraw_fringe_bitmaps_p = 1;
     }
 
-  return redraw_p;
+  return redraw_p && !keep_current_p;
 }
 
 
@@ -1408,7 +1415,9 @@ Return nil if POS is not visible in WINDOW.  */)
   if (row)
     return list3 (get_fringe_bitmap_name (row->left_fringe_bitmap),
                  get_fringe_bitmap_name (row->right_fringe_bitmap),
-                 (row->overlay_arrow_p ? Qt : Qnil));
+                 (row->overlay_arrow_bitmap == 0 ? Qnil
+                  : row->overlay_arrow_bitmap < 0 ? Qt
+                  : get_fringe_bitmap_name (row->overlay_arrow_bitmap)));
   else
     return Qnil;
 }